Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Inserting Element into existing XML file

Posted on 2013-11-06
10
Medium Priority
?
315 Views
Last Modified: 2013-11-17
Experts, i am attempting to extract a message from an xml file. A message would be everything between <Message> and </Message>. I can do this with no problem. What i am having trouble doing is inserting this into another xml document. so basically a user can copy a message from one machine to another.

My code fails on "xDoc2.appendChild (xNode2)".

I receive an error that states  "Object doesnt support this property or method".
    Dim xDoc As DOMDocument60, xDoc2 As DOMDocument60, xNode As IXMLDOMElement, _
        xmlStr As String, xSub As IXMLDOMNode, xNode2 As IXMLDOMElement
    
    Set xDoc = New DOMDocument60
    
    'Attempt to load the backup file for the selected printer.
    If xDoc.Load("C:\Program Files\ID Technology\CiControl\Backup Files\" & _
                  main.printerView.SelectedItem.Key & "\" & _
                  Format(Date, "mm.dd.yy") & ".xml") Then
                  
        'Find the message xml in the backup file.
        Set xNode = xDoc.selectSingleNode("//Messages/Message[Name='" & msgView.SelectedItem & "']")
        
        'Begin extracting all of the message xml.
        For Each xSub In xNode.childNodes
            
            Debug.Print xSub.xml
            
            'Build the xml string.
            xmlStr = xmlStr & xSub.xml
            
        Next
        
        Set xDoc2 = New DOMDocument60
        
        xDoc2.Load ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" _
                    & Format(Date, "mm.dd.yy") & ".xml")
        
        Set xNode2 = xDoc2.createElement("Message")
        
        xNode2.Text = xmlStr
        
        xDoc2.appendChild (xNode2)
        
        xDoc2.save ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" & _
                    Format(Date, "mm.dd.yy") & ".xml")
        
    End If
    
    Set xDoc = Nothing
    Set xNode = Nothing
    Set xSub = Nothing
    Set xDoc2 = Nothing
    Set xNode2 = Nothing

Open in new window


<Machine>
   <Name>Machine1</Name>
   <IPAddress>192.168.0.1</IPAddress>
   <Message>
      <Name>Message1</Name>
      <Counter1>1</Counter1>
      <Language>EN</Language>
      <Field>
         <Text>Start</Text>
      </Field>
      <Field>
         <Text>Run</Text>
      </Field>
   </Message>
   <Message>
      <Name>Message2</Name>
      <Counter1>1</Counter1>
      <Language>EN</Language>
      <Field>
         <Text>Stop</Text>
      </Field>
      <Field>
         <Text>Run</Text>
      </Field>
   </Message>
</Machine>
0
Comment
Question by:Basicfarmer
  • 8
  • 2
10 Comments
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 39628385
It looks like your problem is that you are attempting to append the node to the document object.  But you've already (correctly) created the new element in the document object.  Now you need to select a child node to append the element to.

You need to either select the Document node (don't recall the function to do that off the top of my head) or you need to select a list of child nodes (like all the existing <Message> nodes) and append the new node to that list perhaps.

Something like this should work:
 Set xNode = xDoc.selectSingleNode("//Messages")
 xNode.appendChild( xNode2 )
0
 

Author Comment

by:Basicfarmer
ID: 39628464
I am struggling to understand this. I think i did what you suggested. I commented out the previous lines and added a couple more. I set xNode2 to the node "Messages". Then with the xElement i create a new node "Message". Then i added the xmlStr data to that node. I am still getting the error "Object doesnt support this property or method" at
"xNode2.appendChild (xElement)"

    Dim xDoc As DOMDocument60, xDoc2 As DOMDocument60, xNode As IXMLDOMElement, _
        xmlStr As String, xSub As IXMLDOMNode, xNode2 As IXMLDOMElement
    
    Set xDoc = New DOMDocument60
    
    'Attempt to load the backup file for the selected printer.
    If xDoc.Load("C:\Program Files\ID Technology\CiControl\Backup Files\" & _
                  main.printerView.SelectedItem.Key & "\" & _
                  Format(Date, "mm.dd.yy") & ".xml") Then
                  
        'Find the message xml in the backup file.
        Set xNode = xDoc.selectSingleNode("//Messages/Message[Name='" & msgView.SelectedItem & "']")
        
        'Begin extracting all of the message xml.
        For Each xSub In xNode.childNodes
            
            Debug.Print xSub.xml
            
            'Build the xml string.
            xmlStr = xmlStr & xSub.xml
            
        Next
        
        Set xDoc2 = New DOMDocument60
        
        xDoc2.Load ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" _
                    & Format(Date, "mm.dd.yy") & ".xml")
        
        'Set xNode2 = xDoc2.createElement("Message")
        Set xNode2 = xDoc2.selectSingleNode("//Messages")
        
        Dim xElement As IXMLDOMElement
        
        Set xElement = xDoc2.createElement("Message")
            
        xElement.Text = xmlStr
        
        xNode2.appendChild (xElement)
        'xDoc2.documentElement.appendChild (xNode2)
        
        xDoc2.save ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" & _
                    Format(Date, "mm.dd.yy") & ".xml")
        
    End If
    
    Set xDoc = Nothing
    Set xNode = Nothing
    Set xSub = Nothing
    Set xDoc2 = Nothing
    Set xNode2 = Nothing

Open in new window

0
 

Author Comment

by:Basicfarmer
ID: 39628633
This is what the variable xmlStr contains.

<Language>English</Language>
<Name>FEDMOG</Name>
<Code>Undefined</Code>
<FontSize>7</FontSize>
<Delay>1500</Delay>
<Bold>0</Bold>
<Width>4</Width>
<Gap>1</Gap>
<Height>180</Height>
<Pixel>9</Pixel>
<Orientation>Mirror Up</Orientation>
<Alternate0>No</Alternate0>
<Alternate1>No</Alternate1>
<Alternate7>No</Alternate7>
<RepeatPitch>0</RepeatPitch>
<RepeatPrint>0</RepeatPrint>
<AutoPrintPitch>0</AutoPrintPitch>
<LanguageShifts>English</LanguageShifts>
<ExpirationRolldown>Off</ExpirationRolldown>
<ExpirationDate1>
    <Day>30</Day>
    <Week>0</Week>
    <Month>0</Month>
    <Year>0</Year>
</ExpirationDate1>
<ExpirationDate2>
    <Day>60</Day>
    <Week>0</Week>
    <Month>0</Month>
    <Year>0</Year>
</ExpirationDate2>
<TimeCreated>
    <Date>
        <Year>2013</Year>
        <Month>11</Month>
        <Day>4</Day>
    </Date>
    <Time>
        <Hour>9</Hour>
        <Minute>15</Minute>
    </Time>
</TimeCreated>
<CounterDate>
    <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
    </Date>
</CounterDate>
<Shift>
    <Text>A</Text>
    <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
    </Time>
</Shift>
<Counter1>
    <Start>0</Start>
    <Upper>100000</Upper>
    <Lower>0</Lower>
    <Increment>1</Increment>
    <Repeat>0</Repeat>
    <RepeatStart>0</RepeatStart>
    <Digits>6</Digits>
    <LeadZero>Yes</LeadZero>
    <Value>0</Value>
    <WrapAround>Yes</WrapAround>
</Counter1>
<Counter2>
    <Start>0</Start>
    <Upper>100000</Upper>
    <Lower>0</Lower>
    <Increment>1</Increment>
    <Repeat>0</Repeat>
    <RepeatStart>0</RepeatStart>
    <Digits>6</Digits>
    <LeadZero>Yes</LeadZero>
    <Value>0</Value>
    <WrapAround>Yes</WrapAround>
</Counter2>
<Field>
    <Type>Text</Type>
    <Language>English</Language>
    <Text>B13296</Text>
    <FontSize>9</FontSize>
    <FontName>30020900</FontName>
    <Bold>0</Bold>
    <Gap>0</Gap>
    <X>0</X>
    <Y>0</Y>
    <Orientation>Upside Up</Orientation>
</Field>

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 39628827
I tried testing your code and as best as I can come up with, your statements inside the 'SelectSingleNode' commands are not matching on anything (such as the syntax isn't what you think it is).  When I did my best to try to execute your code, I kept getting 'Nothing' as the result of the SelectSingleNode commands.

What I did do was to copy the XML data you 1st gave into a file I saved in C:\Temp\temp.xml.  I made a 2nd copy named C:\Temp\temp2.xml.  I was then able to successfully execute the following code:
Dim xDoc As DOMDocument60
Dim xDoc2 As DOMDocument60
Dim xNode As IXMLDOMElement
Dim xmlStr As String
Dim xSub As IXMLDOMNode
Dim xNode2 As IXMLDOMElement
    
    Set xDoc = New DOMDocument60
    
    'Attempt to load the backup file for the selected printer.
    If xDoc.Load("C:\Temp\Temp.xml") Then
                  
        'Find the message xml in the backup file.
        'Set xNode = xDoc.selectSingleNode("Messages/Message")
        Set xNode = xDoc.childNodes(0).childNodes(0)
        
        'Begin extracting all of the message xml.
        For Each xSub In xNode.childNodes
            Debug.Print xSub.xml
            'Build the xml string.
            xmlStr = xmlStr & xSub.xml
        Next
        
        Set xDoc2 = New DOMDocument60
        Call xDoc2.Load("C:\Temp\Temp2.xml")
        Set xNode2 = xDoc2.documentElement
        
        Dim xElement As IXMLDOMElement
        Set xElement = xDoc2.createElement("Message")
        xElement.Text = xmlStr
        Call xNode2.appendChild(xElement)
        Call xDoc2.save("C:\Temp\Temp3.xml")
    End If
    
    Set xDoc = Nothing
    Set xNode = Nothing
    Set xSub = Nothing
    Set xDoc2 = Nothing
    Set xNode2 = Nothing
End Sub

Open in new window

0
 

Author Comment

by:Basicfarmer
ID: 39628870
I think i made a mistake at the very beginning by trying to make a lame illustration of some xml. I think maybe i should post the entire xml file i am working with so you can see what i am trying to do in extracting a message and then insert a message. I will take a closer look at what you have done when i get home this evening. In my code at line 36, the value of xmlStr is the message xml that i posted right above your last comment. So i have extracted it successfully and I believe that i have successfully created the node xElement. Maybe if you see the entire xml file you can see where i am going wrong.

Dont let the first <Message></Message> fool you. That represents the current message being run by the machine. The messages I am working with are in <Messages></Messages>. Between those elements you will find the <Message></Message that i want to work with.

I will look at this closer this evening.
Thanks...

<CiControl>
<System>
  <SystemInfo>
    <Version>6.01s</Version>
    <Serial>87B531010000</Serial>
    <BoardRevision>4</BoardRevision>
    <SaveDate>11/06/2013</SaveDate>
    <SaveTime>15:11:36</SaveTime>
    <PowerOnTime>5266</PowerOnTime>
    <RunTime>270</RunTime>
    <TotalPrints>238433</TotalPrints>
  </SystemInfo>
  <SystemProperties>
    <DateFormat>MMDDYYYY</DateFormat>
    <Measurement>USCS</Measurement>
    <Language>English</Language>
    <Rollover>
      <Hour>3</Hour>
      <Minute>30</Minute>
    </Rollover>
    <ServiceContactProperties>
      <Language>English</Language>
      <Distributor>DEFAULT</Distributor>
      <Contact>------</Contact>
      <Telephone>------</Telephone>
      <Email>-----@---.com</Email>
    </ServiceContactProperties>
    <AlarmOptions>
      <Failures>
        <Alarm1>Flash</Alarm1>
        <Alarm2>Flash</Alarm2>
        <Alarm3>Off</Alarm3>
        <Alarm4>Off</Alarm4>
        <Relay>On</Relay>
      </Failures>
      <Warnings>
        <Alarm1>Flash</Alarm1>
        <Alarm2>N/C</Alarm2>
        <Alarm3>N/C</Alarm3>
        <Alarm4>Off</Alarm4>
        <Relay>N/C</Relay>
      </Warnings>
      <PrintReady>
        <Alarm1>N/C</Alarm1>
        <Alarm2>N/C</Alarm2>
        <Alarm3>On</Alarm3>
        <Alarm4>Off</Alarm4>
        <Relay>Off</Relay>
      </PrintReady>
      <PrintNotReady>
        <Alarm1>Flash</Alarm1>
        <Alarm2>N/C</Alarm2>
        <Alarm3>Off</Alarm3>
        <Alarm4>On</Alarm4>
        <Relay>On</Relay>
      </PrintNotReady>
    </AlarmOptions>
  </SystemProperties>
  <ApplicationProperties>
    <AutoPrint>Off</AutoPrint>
    <PrintMode>Normal</PrintMode>
    <Encoder>External</Encoder>
    <TriggerEdge1>Rising</TriggerEdge1>
    <TriggerEdge2>Rising</TriggerEdge2>
    <PC2Option>Off</PC2Option>
    <Debounce>0</Debounce>
    <PrintQuality>Premium Plus</PrintQuality>
    <DropSize>Macro</DropSize>
    <CounterReset>On</CounterReset>
    <Length>20</Length>
    <PrintLength>2</PrintLength>
    <HijriAdjust>0</HijriAdjust>
    <Tower>Off</Tower>
    <MaxCounters>2</MaxCounters>
    <WeekStart>Jan 1</WeekStart>
    <DateDelimiter>/</DateDelimiter>
    <TimeDelimiter>:</TimeDelimiter>
    <Atlas>
      <Code>Disabled</Code>
      <Date>
        <Year>2004</Year>
        <Month>1</Month>
        <Day>1</Day>
      </Date>
    </Atlas>
    <CalendarProperties>
      <DayMonth>
        <Language>English</Language>
        <Data>1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,P,R,S,T,U,V,W,X,Y,</Data>
      </DayMonth>
      <Day>
        <Language>English</Language>
        <Data>SUN,MON,TUE,WED,THU,FRI,SAT,</Data>
      </Day>
      <Month>
        <Language>English</Language>
        <Data>JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC,</Data>
      </Month>
      <Year>
        <Language>English</Language>
        <Data>A,B,C,D,E,F,G,H,I,J,</Data>
      </Year>
    </CalendarProperties>
    <EncodedDate>
      <Date>
        <Year>0</Year>
        <Month>0</Month>
        <Day>0</Day>
      </Date>
    </EncodedDate>
    <EncodedTime>
      <Time>
        <Hour>0</Hour>
        <Minute>0</Minute>
        <Second>0</Second>
      </Time>
    </EncodedTime>
  </ApplicationProperties>
  <InterfaceProperties>
    <AcknowledgeReady>No</AcknowledgeReady>
    <AcknowledgeComplete>No</AcknowledgeComplete>
    <AcknowledgePhotocell>No</AcknowledgePhotocell>
    <ErrorReport>Yes</ErrorReport>
    <Echo>No</Echo>
    <VJEmulate>No</VJEmulate>
    <ExternalInterface>ASCII</ExternalInterface>
    <Baud>115200</Baud>
    <DataBits>8</DataBits>
    <StopBits>1</StopBits>
    <Parity>None</Parity>
    <IPAddress>192.168.000.088</IPAddress>
    <IPMask>255.255.255.000</IPMask>
    <IPGateway>000.000.000.000</IPGateway>
    <IPDNS>000.000.000.000</IPDNS>
    <InternetID></InternetID>
    <TimeZoneDiff>0</TimeZoneDiff>
    <NetworkTime>No</NetworkTime>
    <NTP1>000.000.000.000</NTP1>
    <NTP2>000.000.000.000</NTP2>
  </InterfaceProperties>
  <EmailProperties>
    <UserName></UserName>
    <Password></Password>
    <FromAddress></FromAddress>
    <ToAddress></ToAddress>
    <SMTPServer></SMTPServer>
  </EmailProperties>
  <SecurityProperties>
    <PrintEnableUser>Log On Not Required</PrintEnableUser>
    <EthernetAccess>Log On Not Required</EthernetAccess>
  </SecurityProperties>
  <HardwareProperties>
    <InkFilter>2000</InkFilter>
    <PrePmpFilter>4000</PrePmpFilter>
    <MakeupFilter>4000</MakeupFilter>
    <GutterFilter>2000</GutterFilter>
    <FanFilter>2000</FanFilter>
    <HVTrip>61</HVTrip>
    <Charge>72,72,74,72</Charge>
    <ViscosityCal>36111</ViscosityCal>
    <Modulation>190,180,180,150</Modulation>
    <BandSetting>-1,0,0,0</BandSetting>
    <PumpPressure>40,40,40,40</PumpPressure>
    <GutterOffset>0,0,0,0</GutterOffset>
    <PumpSpeed>60</PumpSpeed>
    <InkStir>No</InkStir>
  </HardwareProperties>
  <Message>
    <Language>English</Language>
    <Name>JUSTIN</Name>
    <Code>0</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>100</Width>
    <Gap>0</Gap>
    <Height>200</Height>
    <Pixel>16</Pixel>
    <Orientation>Upside Up</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>0</Year>
        <Month>0</Month>
        <Day>0</Day>
      </Date>
      <Time>
        <Hour>0</Hour>
        <Minute>0</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>0</Year>
        <Month>0</Month>
        <Day>0</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
  </Message>
</System>
<Messages>
  <Message>
    <Language>English</Language>
    <Name>DEFAULT</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>5000</Delay>
    <Bold>0</Bold>
    <Width>200</Width>
    <Gap>0</Gap>
    <Height>200</Height>
    <Pixel>16</Pixel>
    <Orientation>Upside Up</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>1</Month>
        <Day>24</Day>
      </Date>
      <Time>
        <Hour>11</Hour>
        <Minute>19</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>1</Month>
        <Day>24</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>CITRONIX CIJ</Text>
      <FontSize>16</FontSize>
      <FontName>30021600</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
    <Field>
      <Type>AutoCode</Type>
      <Language>English</Language>
      <Format>MMDDYY</Format>
      <DateDelimiter>/</DateDelimiter>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>160</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
    <Field>
      <Type>AutoCode</Type>
      <Language>English</Language>
      <Format>HHMMSS</Format>
      <TimeDelimiter>:</TimeDelimiter>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>160</X>
      <Y>9</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>GG</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>5</Width>
    <Gap>2</Gap>
    <Height>200</Height>
    <Pixel>7</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>4</Month>
        <Day>10</Day>
      </Date>
      <Time>
        <Hour>7</Hour>
        <Minute>17</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>17</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>17</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>FLEX TECHNOLOGIES  040513 ASTM PN 1234567</Text>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>0</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>TEST 2</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>2200</Delay>
    <Bold>0</Bold>
    <Width>3</Width>
    <Gap>1</Gap>
    <Height>210</Height>
    <Pixel>25</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>8</Month>
        <Day>30</Day>
      </Date>
      <Time>
        <Hour>11</Hour>
        <Minute>33</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>4</Month>
        <Day>16</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>5/8&quot; EASYSET WEIGHTED AI RLDE</Text>
      <FontSize>25</FontSize>
      <FontName>30022500</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>NEW</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>800</Delay>
    <Bold>1</Bold>
    <Width>4</Width>
    <Gap>1</Gap>
    <Height>200</Height>
    <Pixel>9</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>10</Month>
        <Day>21</Day>
      </Date>
      <Time>
        <Hour>10</Hour>
        <Minute>44</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>BOWSMITH PREMIUM PLUS TUBING 835P52 LOT #001163 10/11/13</Text>
      <FontSize>9</FontSize>
      <FontName>30020900</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>TEST</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>10</Width>
    <Gap>0</Gap>
    <Height>200</Height>
    <Pixel>16</Pixel>
    <Orientation>Mirror Up</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>4</Month>
        <Day>16</Day>
      </Date>
      <Time>
        <Hour>12</Hour>
        <Minute>35</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>4</Month>
        <Day>16</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>TESTING</Text>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Down</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>NEW2</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>800</Delay>
    <Bold>0</Bold>
    <Width>3</Width>
    <Gap>0</Gap>
    <Height>180</Height>
    <Pixel>9</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>10</Month>
        <Day>25</Day>
      </Date>
      <Time>
        <Hour>9</Hour>
        <Minute>35</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>OYOSPORTSTOYS.COM</Text>
      <FontSize>9</FontSize>
      <FontName>30020900</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>Adrian 020513</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>12000</Delay>
    <Bold>0</Bold>
    <Width>80</Width>
    <Gap>1</Gap>
    <Height>255</Height>
    <Pixel>9</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
      <Time>
        <Hour>8</Hour>
        <Minute>38</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>TEST ID</Text>
      <FontSize>9</FontSize>
      <FontName>30020900</FontName>
      <Bold>0</Bold>
      <Gap>0</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>FEDMOG</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>4</Width>
    <Gap>1</Gap>
    <Height>180</Height>
    <Pixel>9</Pixel>
    <Orientation>Mirror Up</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>11</Month>
        <Day>4</Day>
      </Date>
      <Time>
        <Hour>9</Hour>
        <Minute>15</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>B13296</Text>
      <FontSize>9</FontSize>
      <FontName>30020900</FontName>
      <Bold>0</Bold>
      <Gap>0</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>JUSTIN</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>4</Width>
    <Gap>0</Gap>
    <Height>175</Height>
    <Pixel>2L7</Pixel>
    <Orientation>Upside Down</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>10</Month>
        <Day>18</Day>
      </Date>
      <Time>
        <Hour>9</Hour>
        <Minute>6</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>10</Month>
        <Day>15</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>SHIFT B</Text>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>12/10/75</Text>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>1</Gap>
      <X>0</X>
      <Y>8</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
  <Message>
    <Language>English</Language>
    <Name>FEDMOG2</Name>
    <Code>Undefined</Code>
    <FontSize>7</FontSize>
    <Delay>1500</Delay>
    <Bold>0</Bold>
    <Width>4</Width>
    <Gap>1</Gap>
    <Height>180</Height>
    <Pixel>7</Pixel>
    <Orientation>Mirror Up</Orientation>
    <Alternate0>No</Alternate0>
    <Alternate1>No</Alternate1>
    <Alternate7>No</Alternate7>
    <RepeatPitch>0</RepeatPitch>
    <RepeatPrint>0</RepeatPrint>
    <AutoPrintPitch>0</AutoPrintPitch>
    <LanguageShifts>English</LanguageShifts>
    <ExpirationRolldown>Off</ExpirationRolldown>
    <ExpirationDate1>
      <Day>30</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate1>
    <ExpirationDate2>
      <Day>60</Day>
      <Week>0</Week>
      <Month>0</Month>
      <Year>0</Year>
    </ExpirationDate2>
    <TimeCreated>
      <Date>
        <Year>2013</Year>
        <Month>11</Month>
        <Day>4</Day>
      </Date>
      <Time>
        <Hour>11</Hour>
        <Minute>46</Minute>
      </Time>
    </TimeCreated>
    <CounterDate>
      <Date>
        <Year>2013</Year>
        <Month>2</Month>
        <Day>5</Day>
      </Date>
    </CounterDate>
    <Shift>
      <Text>A</Text>
      <Time>
        <Hour>8</Hour>
        <Minute>0</Minute>
      </Time>
    </Shift>
    <Counter1>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter1>
    <Counter2>
      <Start>0</Start>
      <Upper>100000</Upper>
      <Lower>0</Lower>
      <Increment>1</Increment>
      <Repeat>0</Repeat>
      <RepeatStart>0</RepeatStart>
      <Digits>6</Digits>
      <LeadZero>Yes</LeadZero>
      <Value>0</Value>
      <WrapAround>Yes</WrapAround>
    </Counter2>
    <Field>
      <Type>Text</Type>
      <Language>English</Language>
      <Text>B13296</Text>
      <FontSize>7</FontSize>
      <FontName>30020700</FontName>
      <Bold>0</Bold>
      <Gap>0</Gap>
      <X>0</X>
      <Y>0</Y>
      <Orientation>Upside Up</Orientation>
    </Field>
  </Message>
</Messages>
<MessageSequences>
  <MessageSequence>
    <Language>English</Language>
    <Name>GlobalTest</Name>
  </MessageSequence>
</MessageSequences>
<Graphics>
  <Graphic>
    <Language>English</Language>
    <Name>USDA</Name>
    <Width>56</Width>
    <Height>25</Height>
    <Data>0020010008000000D00280160000070FFC7FE1C00038000000003800C0000000000600401118F040040020112488A0080010112088A010001011188910100010110489F0100010112489101000100E18F2081000100000000010001000000000100020C7D0F9CF8800412410822204008104108202020080C7D0FA020200802410820202004124108222040030C7DEF9C218000C00000000600003FFF83FFF8000000006C000000000000100000000</Data>
  </Graphic>
  <Graphic>
    <Language>English</Language>
    <Name>UR GRAPHIC</Name>
    <Width>32</Width>
    <Height>16</Height>
    <Data>3FF038007FF03800FFF03800F0381C00E0381C00E0381C00F0381C007FF81C003FFC0E000FFC0E0003DC0E00079C0E000F0E0E001E07FE003C07FC003803F800</Data>
  </Graphic>
</Graphics>
</CiControl>

Open in new window

0
 

Author Comment

by:Basicfarmer
ID: 39629116
I went back and looked and the structure of the xml in my original post and it was incorrect. The xml above is what i am working with.

It has the structure of

<Machine>
   <Messages>
      <Message>
         <MessageName>Message1</MessageName>
         <MessageStuff>Stuff</MessageStuff>
      </Message>
      <Message>
         <MessageName>Message2</MessageName>
         <MessageStuff>Stuff</MessageStuff>
      </Message>
   </Messages>
</Machine>

So I am setting xNode2 to "Messages"
Set xNode2 = xDoc2.selectSingleNode("//Messages")
This is the node that i want to append a child to.

Then i create the element "Message"
       
Dim xElement As IXMLDOMElement
Set xElement = xDoc2.createElement("Message")

I add the message xml to the element.            
xElement.Text = xmlStr
       
Debug.Print xElement.Text
Here i can see that i have indeed created the element and added the xml to it.

This is where i cannot seem to get past.        
xNode2.appendChild (xElement)

I think i understand what you did but i think it was like i said that i was incorrect in my original post about the structure of the xml.

Dont i have to set xNode2 to the node that i want to append a child to?
Set xNode2 = xDoc2.selectSingleNode("//Messages")

This is very frustrating everything i have read on here and other sites say this should be working if i have any clue at all which i may not.
0
 

Author Comment

by:Basicfarmer
ID: 39629345
I have cleaned up the code a little bit and got rid of some of the comments. And this is what i know at this point. I added a debug line right after setting the xNode element. So i can verify that i have selected the <Messages> node. I have attached the debug output of xNode just after the code i just ran. I have also attached the xml file.

 
    Dim xdoc As DOMDocument60, xDoc2 As DOMDocument60, xNode As IXMLDOMElement, _
        xmlStr As String, xSub As IXMLDOMNode, xNode2 As IXMLDOMElement, _
        xElement As IXMLDOMElement
    
    Set xdoc = New DOMDocument60
    
    'Attempt to load the backup file for the selected printer.
    If xdoc.Load("C:\Program Files\ID Technology\CiControl\Backup Files\" & _
                  main.printerView.SelectedItem.Key & "\" & _
                  Format(Date, "mm.dd.yy") & ".xml") Then
                  
        'Find the message xml in the backup file.
        Set xNode = xdoc.selectSingleNode("//Messages/Message[Name='" & msgView.SelectedItem & "']")
        
        'Begin extracting all of the message xml.
        For Each xSub In xNode.childNodes
            
            Debug.Print xSub.xml
            
            'Build the xml string.
            xmlStr = xmlStr & xSub.xml
            
        Next
        
        Set xDoc2 = New DOMDocument60
        
        xDoc2.Load ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\11.05.13.xml")
        
        Set xNode2 = xDoc2.selectSingleNode("//Messages")
        
        Debug.Print xNode2.xml
        
        Set xElement = xDoc2.createElement("Message")
            
        xElement.Text = xmlStr
        
        Debug.Print xmlStr
        
        xNode2.appendChild (xElement)
        
        xDoc2.save ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" & _
                    Format(Date, "mm.dd.yy") & ".xml")
        
    End If
    
    Set xdoc = Nothing
    Set xNode = Nothing
    Set xSub = Nothing
    Set xDoc2 = Nothing
    Set xNode2 = Nothing
    Set xElement = Nothing

Open in new window


<Messages>
    <Message>
        <Language>English</Language>
        <Name>DEFAULT</Name>
        <Code>Undefined</Code>
        <FontSize>7</FontSize>
        <Delay>5000</Delay>
        <Bold>0</Bold>
        <Width>200</Width>
        <Gap>0</Gap>
        <Height>200</Height>
        <Pixel>16</Pixel>
        <Orientation>Upside Up</Orientation>
        <Alternate0>No</Alternate0>
        <Alternate1>No</Alternate1>
        <Alternate7>No</Alternate7>
        <RepeatPitch>0</RepeatPitch>
        <RepeatPrint>0</RepeatPrint>
        <AutoPrintPitch>0</AutoPrintPitch>
        <LanguageShifts>English</LanguageShifts>
        <ExpirationRolldown>Off</ExpirationRolldown>
        <ExpirationDate1>
            <Day>30</Day>
            <Week>0</Week>
            <Month>0</Month>
            <Year>0</Year>
        </ExpirationDate1>
        <ExpirationDate2>
            <Day>60</Day>
            <Week>0</Week>
            <Month>0</Month>
            <Year>0</Year>
        </ExpirationDate2>
        <TimeCreated>
            <Date>
                <Year>2013</Year>
                <Month>1</Month>
                <Day>24</Day>
            </Date>
            <Time>
                <Hour>11</Hour>
                <Minute>19</Minute>
            </Time>
        </TimeCreated>
        <CounterDate>
            <Date>
                <Year>2013</Year>
                <Month>1</Month>
                <Day>24</Day>
            </Date>
        </CounterDate>
        <Shift>
            <Text>A</Text>
            <Time>
                <Hour>8</Hour>
                <Minute>0</Minute>
            </Time>
        </Shift>
        <Counter1>
            <Start>0</Start>
            <Upper>100000</Upper>
            <Lower>0</Lower>
            <Increment>1</Increment>
            <Repeat>0</Repeat>
            <RepeatStart>0</RepeatStart>
            <Digits>6</Digits>
            <LeadZero>Yes</LeadZero>
            <Value>0</Value>
            <WrapAround>Yes</WrapAround>
        </Counter1>
        <Counter2>
            <Start>0</Start>
            <Upper>100000</Upper>
            <Lower>0</Lower>
            <Increment>1</Increment>
            <Repeat>0</Repeat>
            <RepeatStart>0</RepeatStart>
            <Digits>6</Digits>
            <LeadZero>Yes</LeadZero>
            <Value>0</Value>
            <WrapAround>Yes</WrapAround>
        </Counter2>
        <Field>
            <Type>Text</Type>
            <Language>English</Language>
            <Text>CITRONIX CIJ</Text>
            <FontSize>16</FontSize>
            <FontName>30021600</FontName>
            <Bold>0</Bold>
            <Gap>1</Gap>
            <X>0</X>
            <Y>0</Y>
            <Orientation>Upside Up</Orientation>
        </Field>
        <Field>
            <Type>AutoCode</Type>
            <Language>English</Language>
            <Format>MMDDYY</Format>
            <DateDelimiter>/</DateDelimiter>
            <FontSize>7</FontSize>
            <FontName>30020700</FontName>
            <Bold>0</Bold>
            <Gap>1</Gap>
            <X>160</X>
            <Y>0</Y>
            <Orientation>Upside Up</Orientation>
        </Field>
        <Field>
            <Type>AutoCode</Type>
            <Language>English</Language>
            <Format>HHMMSS</Format>
            <TimeDelimiter>:</TimeDelimiter>
            <FontSize>7</FontSize>
            <FontName>30020700</FontName>
            <Bold>0</Bold>
            <Gap>1</Gap>
            <X>160</X>
            <Y>9</Y>
            <Orientation>Upside Up</Orientation>
        </Field>
    </Message>
</Messages>

Open in new window

11.05.13.xml
0
 

Author Comment

by:Basicfarmer
ID: 39630855
I just tried getting rid of the xElement object and doing the following.

xNode2 = xDoc2.selectSingleNode("//Messages")
xnode2.appendChild (xnode.cloneNode(True))

i still get "Object doesn't support this property or method".

I can verify at any point after setting  xNode2 that is it not nothing. I can debug the xml of xNode2 and verify that it contains the <Messages></Messages>.

How am i using appendChild incorrectly?
0
 

Accepted Solution

by:
Basicfarmer earned 0 total points
ID: 39632471
Ok, i finally figured it out. I was able to use the cloneNode method and get rid of the element object and get rid of the For loop to get the xml. I dont know why i didnt realize that the object xNode already had the message in its entirety.

But i still do not understand why what i was doing did not work. It all seemed like it should have worked.

xNode2.appendChild(xelement)

Please let me know why what i was doing did not work so i can understand. Just because i was able to get through it i still have questions about what i was trying to do.

And i also do not understand why xNode2 is required for this to work. It does not appear to be doing anything.

Private Sub copy_Click()

    Dim xdoc As DOMDocument60, xDoc2 As DOMDocument60, xNode As IXMLDOMElement, _
        xmlStr As String, xNode2 As IXMLDOMNode
    
    Set xdoc = New DOMDocument60
    
    'Attempt to load the backup file for the selected printer.
    If xdoc.Load("C:\Program Files\ID Technology\CiControl\Backup Files\" & _
                  main.printerView.SelectedItem.Key & "\" & _
                  Format(Date, "mm.dd.yy") & ".xml") Then
                  
        'Find the message xml in the backup file.
        Set xNode = xdoc.selectSingleNode("//Messages/Message[Name='" & msgView.SelectedItem & "']")
        
        'Create the new document object.
        Set xDoc2 = New DOMDocument60
        
        'Load the target xml file into memory.
        xDoc2.Load ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" & _
                    Format(Date, "mm.dd.yy") & ".xml")
        
        'Append the message node to the messages node in the target file.
        Set xNode2 = xDoc2.selectSingleNode("//Messages").appendChild(xNode.cloneNode(True))
        
        'Save the modified document.
        xDoc2.save ("C:\Program Files\ID Technology\CiControl\Backup Files\127.0.0.1\" & _
                    Format(Date, "mm.dd.yy") & ".xml")
        
    End If
    
    Set xdoc = Nothing
    Set xNode = Nothing
    Set xDoc2 = Nothing
    Set xNode2 = Nothing

Open in new window

0
 

Author Closing Comment

by:Basicfarmer
ID: 39654321
I was able to resolve the original question on my own.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question