How to display this nested array with sub blocks? - docx

Single item of array:
array(3) {
'name' =>
string(19) "trigger_assignments"
'description' =>
string(67) "Maps trigger to hook and operation assignments from trigger.module."
'fields' =>
array(3) {
[0] =>
array(3) {
'name' =>
string(4) "hook"
'description' =>
string(76) "Primary Key: The name of the internal Drupal hook; for example, node_insert."
'type' =>
string(7) "varchar"
}
[1] =>
array(3) {
'name' =>
string(3) "aid"
'description' =>
string(36) "Primary Key: Action's {actions}.aid."
'type' =>
string(7) "varchar"
}
[2] =>
array(3) {
'name' =>
string(6) "weight"
'description' =>
string(67) "The weight of the trigger assignment in relation to other triggers."
'type' =>
string(3) "int"
}
}
}
I can't display 'fields' array. It should be display in table, my code:
[c;block=begin; sub1=(fields)]
Nazwa tabeli: [c.name;]
[c.description;]
Lista pól tabeli:
Nazwa Typ Opis
[c_sub1.name;block=tr] [c_sub1.type;] [c_sub1.description;]
[c;block=end]
The sample result is:
Nazwa tabeli: aggregator_category
Stores categories for aggregator feeds and feed items.
Lista pól tabeli:
Nazwa Typ Opis
[c_sub1.name;block=tr] [c_sub1.type;] [c_sub1.description;]
So table with fields was not displayed.
Could someone give me any advixe?
Code:
$TBS->MergeBlock('c', $table);
$table has items like above inside.
XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14" xml:space="preserve">
<w:body>
<w:p w:rsidRDefault="00905443" w:rsidP="00273597">
<w:r>
<w:t>
</w:t>
</w:r>
</w:p>
<w:p w:rsidRDefault="00595A19" w:rsidP="00273597">
<w:r>
<w:t>
Nazwa tabeli: aggregator_category
</w:t>
</w:r>
</w:p>
<w:p w:rsidRDefault="008248E2" w:rsidP="00273597">
<w:r>
<w:t>
Stores categories for aggregator feeds and feed items.
</w:t>
</w:r>
</w:p>
<w:p w:rsidRDefault="00462CAC" w:rsidP="00273597">
<w:r>
<w:t>
Lista pól tabeli:
</w:t>
</w:r>
</w:p>
<w:p w:rsidRDefault="00F53554" w:rsidP="00F53554">
<w:pPr>
<w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
<w:rPr>
<w:rFonts w:ascii="Times New Roman" w:eastAsia="Times New Roman" w:hAnsi="Times New Roman"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:pPr>
</w:p>
<w:tbl>
<w:tblPr>
<w:tblpPr w:leftFromText="141" w:rightFromText="141" w:vertAnchor="text" w:horzAnchor="margin" w:tblpXSpec="center" w:tblpY="425"/>
<w:tblW w:w="9606" w:type="dxa"/>
<w:tblBorders>
<w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/>
<w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/>
<w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/>
<w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/>
<w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/>
<w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/>
</w:tblBorders>
<w:tblLook w:val="01E0" w:firstRow="1" w:lastRow="1" w:firstColumn="1" w:lastColumn="1" w:noHBand="0" w:noVBand="0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="2440"/>
<w:gridCol w:w="1567"/>
<w:gridCol w:w="5599"/>
</w:tblGrid>
<w:tr w:rsidTr="005C7EBF">
<w:trPr>
<w:trHeight w:hRule="exact" w:val="340"/>
<w:tblHeader/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2440" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="C0C0C0"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidRDefault="00CE4402" w:rsidP="005E0ABE">
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:rPr>
<w:b/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>
Nazwa
</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1567" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="C0C0C0"/>
</w:tcPr>
<w:p w:rsidRDefault="00CE4402" w:rsidP="005E0ABE">
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:rPr>
<w:b/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>
Typ
</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5599" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="C0C0C0"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidRDefault="00CE4402" w:rsidP="005E0ABE">
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:rPr>
<w:b/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>
Opis
</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidTr="005C7EBF">
<w:trPr>
<w:trHeight w:hRule="exact" w:val="521"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2440" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidRDefault="005C7EBF" w:rsidP="005C7EBF">
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Verdana" w:eastAsia="Times New Roman" w:hAnsi="Verdana"/>
<w:color w:val="000000"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
</w:rPr>
<w:t>
[c_sub1.name;block=tr]
</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1567" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidRDefault="005C7EBF" w:rsidP="005C7EBF">
<w:pPr>
<w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Verdana" w:eastAsia="Times New Roman" w:hAnsi="Verdana"/>
<w:color w:val="000000"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
</w:rPr>
<w:t>
[c_sub1.type;]
</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5599" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidRDefault="005C7EBF" w:rsidP="005C7EBF">
<w:pPr>
<w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Verdana" w:eastAsia="Times New Roman" w:hAnsi="Verdana"/>
<w:color w:val="000000"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
</w:rPr>
<w:t>
[c_sub1.description;]
</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p w:rsidRDefault="00A927EE" w:rsidP="00273597">
<w:pPr>
<w:rPr>
<w:rStyle w:val="Strong"/>
<w:rFonts w:ascii="Verdana" w:hAnsi="Verdana"/>
<w:color w:val="006600"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w:rsidRDefault="00905443" w:rsidP="00273597">
<w:r>
<w:rPr>
<w:rFonts w:ascii="Verdana" w:hAnsi="Verdana"/>
<w:color w:val="000000"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF"/>
</w:rPr>
<w:t>
</w:t>
</w:r>
</w:p>
<w:sectPr>
<w:pgSz w:w="11906" w:h="16838"/>
<w:pgMar w:top="1417" w:right="1417" w:bottom="1417" w:left="1417" w:header="708" w:footer="708" w:gutter="0"/>
<w:cols w:space="708"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>

I cannot replicate your result with the information you've given. Using these two test files your data printed like so:
<div>
Name: trigger_assignments<Br>
Maps trigger to hook and operation assignments from trigger.module.
<Br >List:
<table>
<tr>
<td>Nazwa</td>
<td>Typ</td>
<td>Opis</td>
</tr>
<tr>
<td>hook</td>
<td>varchar</td>
<td>Primary Key: The name of the internal Drupal hook; for example, node_insert.</td>
</tr><tr>
<td>aid</td>
<td>varchar</td>
<td>Primary Key: Action's {actions}.aid.</td>
</tr><tr>
<td>weight</td>
<td>int</td>
<td>The weight of the trigger assignment in relation to other triggers.</td>
</tr>
</table>
<br /><br />
</div>
test.php:
$test = array(
array ('name' => "trigger_assignments",
'description' => "Maps trigger to hook and operation assignments from trigger.module.",
'fields' => array(
array('name' => "hook",
'description' => "Primary Key: The name of the internal Drupal hook; for example, node_insert.",
'type' => "varchar"),
array('name' => "aid",
'description' => "Primary Key: Action's {actions}.aid.",
'type' => "varchar"),
array('name' => "weight",
'description' => "The weight of the trigger assignment in relation to other triggers.",
'type' => "int")
)
)
);
include_once('includes/tbs_class.php');
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('test.html');
$TBS->MergeBlock('test', $test);
$TBS->Show();
And test.html:
<div>
[test;block=begin; sub1=(fields)]
Name: [test.name;]<Br>
[test.description;]
<Br >List:
<table>
<tr>
<td>Nazwa</td>
<td>Typ</td>
<td>Opis</td>
</tr>
<tr>
<td>[test_sub1.name;block=tr]</td>
<td>[test_sub1.type;]</td>
<td>[test_sub1.description;]</td>
</tr>
</table>
<br /><br />
[test;block=end]
</div>
Don't know if that helps. Maybe you could give a little more info about your variable 'c' and your $TBS->mergeBlock() command?

Related

Replace text in Word document using .NET Core

I have a Word document where I need to replace certain placeholder variables with actual data using .NET Core.
This is the test document that I'm working with. As you can see it currently has two placeholder variables.
The code I have to read a Word document and replace text comes from MSDN using WordprocessingDocument.
await using var stream = new MemoryStream();
stream.Write(template.Blob, 0, template.Blob.Length);
using (var wordDoc = WordprocessingDocument.Open(stream, true))
{
if (wordDoc.MainDocumentPart == null)
{
return null;
}
string docText;
using (var sr = new StreamReader(wordDoc.MainDocumentPart.GetStream()))
{
docText = await sr.ReadToEndAsync();
}
// Test replacing a variable
Regex regexText = new Regex("{{Building_Current_Version}}");
docText = regexText.Replace(docText, "Some Value");
await using (var sw = new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create)))
{
await sw.WriteAsync(docText);
}
}
But this doesn't work because the docText output is formatted like this:
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:br/>
<w:t>{{</w:t>
</w:r>
<w:proofErr w:type="spellStart"/>
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>Building_Current_Version</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>}}</w:t>
</w:r>
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:br/>
<w:t>{{</w:t>
</w:r>
<w:proofErr w:type="spellStart"/>
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>Building_Current_ValidUntil</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
<w:r w:rsidR="00287CAD">
<w:rPr>
<w:lang w:val="en-US"/>
</w:rPr>
<w:t>}}</w:t>
</w:r>
For some reason the brackets are placed in separate XML tags. But sometimes it doesn't do this. Sometimes it also breaks a variable up in separate XML tags. I'm not adding any formatting to the texts.
So it seems like a simple string replace doesn't work here... Unless there is a way to tell Word not to break up the variables in separate XML tags?
How can I solve this issue?

Sabre OTA_HotelResRS GUARANTEE NOT ACCEPTED

It says guarantee not accepted but I am passing a credit card and guarantee type that was specified in the HotelPropertyDescriptionRS. This failure is occurring across multiple hotels at the moment. Due to the sheer size and number of requests needed to work with Sabre, I posted the full RQ/RS trail from session creation to error on pastebin here: https://pastebin.com/NgH1LmYY
The pertinent pieces are here:
RoomRate from HotelPropertyDescriptionLLSRQ
<RoomRate DirectConnect="false" GuaranteeSurchargeRequired="G" GuaranteedRateProgram="false" HRD_RequiredForSell="false" IATA_CharacteristicIdentification="D1KZZ1" IATA_ProductIdentification="20PCT OFF SAVINGS-PACIFIC" LowInventoryThreshold="false" RPH="028" RateChangeInd="false" RateConversionInd="false" SpecialOffer="false">
<AdditionalInfo>
<CancelPolicy Numeric="03" Option="D" />
<Commission NonCommission="true">**NON-COMMISSIONABLE PRODUCT**</Commission>
<Text>DELUXE KING 350 SQ FT I KING PILLOW TOP BED</Text>
<Text>INTERNET ACCESS 42 INCH LCD TV CABLE CHANNELS</Text>
</AdditionalInfo>
<Rates>
<Rate Amount="239.20" ChangeIndicator="false" CurrencyCode="CAD" HRD_RequiredForSell="false" PackageIndicator="false" RateConversionInd="false" ReturnOfRateInd="false" RoomOnRequest="false">
<AdditionalGuestAmounts>
<AdditionalGuestAmount MaxExtraPersonsAllowed="0" NumAdults="0" NumCribs="0">
<Charges AdultRollAway="0" Crib="0" ExtraPerson="30.00" />
</AdditionalGuestAmount>
</AdditionalGuestAmounts>
<HotelTotalPricing Amount="281.06">
<Disclaimer>INCLUDES TAXES AND SURCHARGES</Disclaimer>
<TotalSurcharges Amount="0.00" />
<TotalTaxes Amount="41.86" />
</HotelTotalPricing>
</Rate>
</Rates>
</RoomRate>
Guarantee's from HotelPropertyDescriptionLLSRQ
<Guarantee>
<DepositsAccepted>
<PaymentCard Code="AX" Type="AMERICAN EXPRESS" />
<PaymentCard Code="CA" Type="MASTERCARD" />
<PaymentCard Code="DC" Type="DINERS CLUB CARD" />
<PaymentCard Code="JC" Type="JCB CREDIT CARD" />
<PaymentCard Code="VI" Type="VISA" />
</DepositsAccepted>
<GuaranteesAccepted>
<PaymentCard Code="AX" Type="AMERICAN EXPRESS" />
<PaymentCard Code="CA" Type="MASTERCARD" />
<PaymentCard Code="DC" Type="DINERS CLUB CARD" />
<PaymentCard Code="JC" Type="JCB CREDIT CARD" />
<PaymentCard Code="VI" Type="VISA" />
<Text>/GAGT GUARANTEE TO AGENCY TIDS/IATA NUMBER</Text>
<Text>/GDPST DEPOSIT WILL BE SENT</Text>
<Text>/GDPST... IMMEDIATE DEPOSIT TYPE OR FORM</Text>
</GuaranteesAccepted>
</Guarantee>
OTA_HotelResRQ:
<OTA_HotelResRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" ReturnHostCommand="true" TimeStamp="2015-05-12T02:00:26-06:00" Version="2.1.0">
<Hotel>
<BasicPropertyInfo InsertAfter="0" RPH="028" />
<Guarantee Type="GDPST">
<CC_Info>
<PaymentCard Code="VI" ExpireDate="REDACTED" Number="****REDACTED" />
<PersonName>
<Surname>REDACTED</Surname>
</PersonName>
</CC_Info>
</Guarantee>
<RoomType NumberOfUnits="1" />
</Hotel>
</OTA_HotelResRQ>
OTA_HotelREsRS:
<OTA_HotelResRS xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:stl="http://services.sabre.com/STL/v01" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.1.0">
<ApplicationResults status="Complete">
<Success timeStamp="2018-01-18T19:26:55-06:00">
<SystemSpecificResults>
<HostCommand LNIATA="222222">/0/0H1½Ú028/GDPSTVI****REDACTEDEXP REDACTED-REDACTED</HostCommand>
</SystemSpecificResults>
</Success>
</ApplicationResults>
<Hotel NumberInParty="2" NumberOfUnits="1" SegmentNumber="1" Status="UC">
<BasicPropertyInfo ChainCode="PF" HotelCityCode="YVR" HotelCode="9976" HotelName="PAN PACIFIC VANCOUV" />
<Guarantee>DPSTVIXXXXXXXXXXXXREDACTEDEXP REDACTED-REDACTED</Guarantee>
<POS>
<Source>
<RequestorID>46796444</RequestorID>
</Source>
</POS>
<RoomRates>
<RoomRate>
<AdditionalInfo>
<CancelPolicy Option="C03D" />
</AdditionalInfo>
<Rates>
<Rate Amount="239.20" CurrencyCode="CAD" DCS_AuxRateCode="D1KZZ1">
<HotelTotalPricing Amount="281.06">
<Disclaimer>INCLUDES TAXES AND SURCHARGES</Disclaimer>
<TotalSurcharges Amount="0.00" />
<TotalTaxes Amount="41.86" />
</HotelTotalPricing>
</Rate>
</Rates>
</RoomRate>
</RoomRates>
<Text>GUARANTEE NOT ACCEPTED</Text>
<TimeSpan Duration="1" End="03-03" Start="03-02" />
</Hotel>
</OTA_HotelResRS>
Obviously IPCC and customer data have been redacted from the outputs below. The hotel says it accepts GDPST and VISA, yet it fails... Why?
That particular rate is showing that needs to be sold with G guarantee type.
GuaranteeSurchargeRequired="G"
Do you get a successful response after changing GDPST to G?

OTA_HotelResRQ direct sell fails with FORMAT ERROR ON OPTIONAL FIELD

I'm making the following sequence of calls to reserve a hotel room using the direct sell request:
HotelPropertyDescriptionRQ
PassengerDetailsRQ
OTA_HotelResRQ
The final response errors with:
FORMAT ERROR ON OPTIONAL FIELD
I'm unable to work out what is causing this error - is it perhaps the RPH of the room is not being correctly added to the PassengerDetailsRQ?
The OTA_HotelResRQ is:
<OTA_HotelResRQ xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ReturnHostCommand="true" TimeStamp="2017-02-13T12:45:24" Version="2.2.0">
<Hotel>
<BasicPropertyInfo RPH="001">
<ConfirmationNumber>PWBA-POW-131c-02</ConfirmationNumber>
</BasicPropertyInfo>
<Guarantee Type="G">
<CC_Info>
<PaymentCard Code="VI" ExpireDate="2018-10" Number="4111111111111111"/>
<PersonName>
<Surname>TEST</Surname>
</PersonName>
</CC_Info>
</Guarantee>
<RoomType NumberOfUnits="1"/>
</Hotel>
The HotelPropertyDescriptionRQ:
<HotelPropertyDescriptionRQ Version="2.3.0" xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<AvailRequestSegment>
<GuestCounts Count="1" />
<HotelSearchCriteria>
<Criterion>
<HotelRef HotelCode="0007855" />
</Criterion>
</HotelSearchCriteria>
<TimeSpan End="2016-12-17" Start="2016-12-10"/>
</AvailRequestSegment>
</HotelPropertyDescriptionRQ>
The PassengerDetailsRQ:
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_3" version="3.3.0" IgnoreOnError="false" HaltOnError="true">
<PostProcessing IgnoreAfter="false" RedisplayReservation="true" UnmaskCreditCard="true">
<EndTransactionRQ>
<EndTransaction Ind="true"></EndTransaction>
<Source ReceivedFrom="PW TESTING"/>
</EndTransactionRQ>
</PostProcessing>
<PreProcessing IgnoreBefore="false">
<UniqueID ID=""/>
</PreProcessing>
<SpecialReqDetails>
<AddRemarkRQ>
<RemarkInfo>
<FOP_Remark>
<CC_Info Suppress="true">
<PaymentCard Code="VI" ExpireDate="2017-12" Number="4444333322221111" SuppressApprovalCode="true"/>
</CC_Info>
</FOP_Remark>
</RemarkInfo>
</AddRemarkRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ>
<AgencyInfo>
<Address>
<AddressLine>XXXXXXXXXXX Ltd</AddressLine>
<CityName>London</CityName>
<CountryCode>GB</CountryCode>
<PostalCode>XXXX XXX</PostalCode>
<StateCountyProv StateCode="LN" />
<StreetNmbr>2 Some Rome</StreetNmbr>
</Address>
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="817-555-1212" PhoneUseType="H" />
</ContactNumbers>
<PersonName Infant="false" NameNumber="1.1">
<GivenName>Iain</GivenName>
<Surname>TESTING</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
I believe it is because you are adding a confirmation number to the sell request, which is an optional field when selling passive segments, but it should not be expected when actually requesting the room to the hotel.
<ConfirmationNumber>PWBA-POW-131c-02</ConfirmationNumber>
I would try removing that.
To reserve a hotel room using the direct sell request from sabre used OTA_HotelResRQ request.
Here is one example for request (i already used this request and get response from sabre)
<?xml version="1.0"?>
-<OTA_HotelResRQ Version="2.2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<Hotel xmlns="http://webservices.sabre.com/sabreXML/2011/10">
<BasicPropertyInfo RPH="001"/>
<Customer NameNumber="01.01"/>
-<Guarantee Type="G">
-<CC_Info>
<PaymentCard Number="3782 8224 6310 005" ExpireDate="2021-09" Code="AX"/>
-<PersonName>
<Surname>tailor</Surname>
</PersonName>
</CC_Info>
</Guarantee>
<RoomType NumberOfUnits="1"/>
</Hotel>
</OTA_HotelResRQ>

import a complex .docx file as .xml and extract the chapters

--update-- maybe someone can assume another possibility so split a .docxdocument into its chapters, importing .docxto R
first of all, I want to give thanks for this awesome forum. I found several solutions for my upcoming issues.
But this time I haven't found anything...
However, I have a complex .docx document, containing an index, formatted to .xml.
library(XML)
xmlfile <- xmlParse("C:/Users/Documents/stihl.xml", options = HUGE)
topxml <- xmlRoot(xmlfile)
topxml <- xmlSApply(topxml, function(x) xmlSApply(x, xmlValue))
xml_df <- data.frame(t(topxml), row.names = NULL, node)
And other possibilities to read an XML file.
My .docx document has an index and now I want to extract the several index content. As an .docx example
1. Introduction
This is an introduction importing XML by R.
2. UserGuide
Userguides are often helpful.
2.1 Style
The style should be always the same.
2.2 Language
I hope my Language is readable, because I'm contacting you from Germany.
As a result it would be nice to receive the content of the seperated chapters, for example stored in a vector.
result
[1]This is an introduction importing XML by R.
[2]Userguides are often helpful.
[3]The style should be always the same.
[4]I hope my Language is readable, because I'm contacting you from Germany.
Maybe there are other possibilities keeping the structure but I mentioned an XML import containing the tree structure as the easiest way.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part
pkg:name="/_rels/.rels"
pkg:contentType="application/vnd.openxmlformats-package.relationships+xml"
pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship
Id="rId3"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
Target="docProps/app.xml"/>
<Relationship
Id="rId2"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
Target="docProps/core.xml"/>
<Relationship Id="rId1"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
Target="word/document.xml"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part
#serveral relationships
</pkg:part>
<pkg:part
pkg:name="/word/document.xml"
pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<w:document mc:Ignorable="w14 w15 wp14"
xmlns:wpc:http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
xmlns:mc:http://schemas.openxmlformats.org/markup-compatibility/2006
xmlns:o:urn:schemas-microsoft-com:office:office
xmlns:r:http://schemas.openxmlformats.org/officeDocument/2006/relationships
xmlns:m:http://schemas.openxmlformats.org/officeDocument/2006/math
xmlns:v:urn:schemas-microsoft-com:vml
xmlns:wp14:http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
xmlns:wp:http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
xmlns:w10:urn:schemas-microsoft-com:office:word
xmlns:w:http://schemas.openxmlformats.org/wordprocessingml/2006/main
xmlns:w14:http://schemas.microsoft.com/office/word/2010/wordml
xmlns:w15:http://schemas.microsoft.com/office/word/2012/wordml
xmlns:wpg:http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
xmlns:wpi:http://schemas.microsoft.com/office/word/2010/wordprocessingInk
xmlns:wne:http://schemas.microsoft.com/office/word/2006/wordml
xmlns:wps:http://schemas.microsoft.com/office/word/2010/wordprocessingShape
<w:body>
<w:p> ...
</w:p>
<w:p w14:paraId="5BB64FEF" w14:textId="77777777" w:rsidR="005A3789" w:rsidRDefault="005A3789" w:rsidP="005A3789">
<w:pPr>
<w:pStyle w:val="Inhaltsverzeichnisberschrift"/>
</w:pPr>
<w:r>
<w:lastRenderedPageBreak/>
<w:t>Inhaltsverzeichnis</w:t>
</w:r>
</w:p>
'Inhaltsverzeichnis' is the titel of my index. The path is
package -> 3.part -> xmldata -> document -> body -> p
The information is stored here for example
<w:p w14:paraId="15ECF978" w14:textId="77777777" w:rsidR="009B5500" w:rsidRDefault="005A3789">
<w:pPr>
<w:pStyle w:val="Verzeichnis1"/>
<w:rPr>
<w:rFonts w:eastAsiaTheme="minorEastAsia"/>
<w:b w:val="0"/>
<w:noProof/>
<w:color w:val="auto"/>
<w:lang w:eastAsia="de-DE"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:b w:val="0"/>
</w:rPr>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:instrText xml:space="preserve"> TOC \o "1-4" \h \z \u
</w:instrText>
</w:r>
<w:r>
<w:rPr>
<w:b w:val="0"/>
</w:rPr>
<w:fldChar w:fldCharType="separate"/>
</w:r>
<w:hyperlink w:anchor="_Toc474825312" w:history="1">
<w:r w:rsidR="009B5500" w:rsidRPr="009D0220"><w:rPr>
<w:rStyle w:val="Hyperlink"/>
<w:noProof/>
</w:rPr>
**<w:t>1</w:t>**
</w:r>
<w:r w:rsidR="009B5500"><w:rPr><w:rFonts w:eastAsiaTheme="minorEastAsia"/>
<w:b w:val="0"/>
<w:noProof/>
<w:color w:val="auto"/>
<w:lang w:eastAsia="de-DE"/>
</w:rPr><w:tab/>
</w:r>
<w:r w:rsidR="009B5500" w:rsidRPr="009D0220">
<w:rPr>
<w:rStyle w:val="Hyperlink"/>
<w:noProof/>
</w:rPr>
**<w:t>Management Summary</w:t>**
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
<w:tab/>
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr><w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
<w:instrText xml:space="preserve"> PAGEREF _Toc474825312 \h </w:instrText>
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
<w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
**<w:t>6</w:t>**
</w:r>
<w:r w:rsidR="009B5500">
<w:rPr>
<w:noProof/>
<w:webHidden/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
</w:hyperlink>
</w:p>
This is the first entry of the index, 1. Management Summary 6
We can use:
library(xml2)
library(magrittr)
x <- read_xml("path/to/file.xml")
titles <- xml_find_all(x,
"/pkg:package//pkg:part/pkg:xmlData/w:document/w:body/w:p/w:hyperlink/w:r/w:t") %>%
xml_text() %>%
matrix(ncol = 3, byrow = T) %>%
as.data.frame()
colnames(titles)<- c('numChapter', 'title', 'numPage')
This retrives the text inside all the nodes corresponding to that xpath.
Based on your given example that xpath contains (what I suppose are) the numChapter, its title and its numPage.
As noted this will give an error if the xml is not well formed and/or some namespaces are missing.
Hope this helps

Using the CAML <Or> and <And> Operators

I'm trying to write a CAML query that does the following:
Get all rows where the _ModerationStatus is Approved.
Get all rows where the _ModerationStatus is Rejected and the row's Requester is the current user, or the row's Manager is the current user.
Get all rows where the _ModerationStatus is Pending and the row's Requester is the current user, or the row's Manager is the current user.
So far I have this CAML query, but when I run it, I get the error Cannot complete this action. Please try again.
<View>
<Query>
<Where>
<Or>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Approved</Value>
</Eq>
<Or>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Pending</Value>
</Eq>
<Eq>
<FieldRef Name='Requester' />
<Value Type='Integer'><UserID /></Value>
</Eq>
</And>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Pending</Value>
</Eq>
<Eq>
<FieldRef Name='Manager' />
<Value Type='Integer'><UserID /></Value>
</Eq>
</And>
</Or>
<Or>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Rejected</Value>
</Eq>
<Eq>
<FieldRef Name='Requester' />
<Value Type='Integer'><UserID /></Value>
</Eq>
</And>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Rejected</Value>
</Eq>
<Eq>
<FieldRef Name='Manager' />
<Value Type='Integer'><UserID /></Value>
</Eq>
</And>
</Or>
</Or>
</Where>
</Query>
</View>
I'm pretty sure that I'm not applying the <Or> and <And> operators correctly, because simpler queries like these three do work for me:
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Approved</Value>
</Eq>
</Where>
</Query>
</View>
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Rejected</Value>
</Eq>
</Where>
</Query>
</View>
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Pending</Value>
</Eq>
</Where>
</Query>
</View>
I ended up with this valid Caml using the U2U Caml Query Builder.
<Query>
<Where>
<Or>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Approved</Value>
</Eq>
<Or>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Rejected</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name='Requester' />
<Value Type='User'>
<UserID />
</Value>
</Eq>
<Eq>
<FieldRef Name='Manager' />
<Value Type='User'>
<UserID />
</Value>
</Eq>
</Or>
</And>
<And>
<Eq>
<FieldRef Name='_ModerationStatus' />
<Value Type='ModStat'>Pending</Value>
</Eq>
<Or>
<Eq>
<FieldRef Name='Requester' />
<Value Type='User'>
<UserID />
</Value>
</Eq>
<Eq>
<FieldRef Name='Manager' />
<Value Type='User'>
<UserID />
</Value>
</Eq>
</Or>
</And>
</Or>
</Or>
</Where>
<OrderBy>
<FieldRef Name='EventDate' Ascending='True' />
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='Location' />
<FieldRef Name='EventDate' />
<FieldRef Name='EndDate' />
<FieldRef Name='Description' />
<FieldRef Name='Requester' />
<FieldRef Name='Manager' />
</ViewFields>
<QueryOptions />

Resources