Read a word embedded in xml tag
Hi everyone...
i am an university student. i am doing a final year project.....dealing with program
i want to ask how to read a word embedded in xml tag...
that is e.g apple
xml file: <fruit> apple </fruit>
<price>$4.00</price>
how to read apple from xml file and using a variable to store the word using java?
pls help.....
If you want to parse XML (more than the simple example you give), I recommend you go here: http://xml.apache.org and download Xerces for Java.
If you want to parse the text yourself, look at:
java.lang.String methods: indexOf(String,int) and substring(int,int)
java.util.StringTokenizer
Similar Messages
-
Problem trying to wrap a Microsoft Word paragraph in XML tags?!? :/
Hello everyone. I really hope this is not a big problem and that some of your could help. I wrote a Macro in VBA like a year ago that was intented to put a tag before every single paragraph in a document. The logic validates that the paragraph have no other
tag before putting one. All of this is based in styles. Some font styles would end up with different tags. This is my code and it works:
Sub edictos()
' Edictos de El Nuevo Día
' 06/20/2005 by Carlos Stella Sistemas de Información
' Actualización 08/08/2012
'Ver 2.0 made by Samuel Otero -> 07/26/2013
Dim oPara As Paragraph
Dim oRng As Range
'Borramos headers y footers
Call ClearHeaderFooters
'Borramos column breaks
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^n"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'Lógica para poner los tags de Tera donde van
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.Style = "C10" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(intro) "
End If
End If
If oPara.Range.Style = "J10" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(intro) "
End If
End If
If oPara.Range.Style = "J12" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(intro) "
End If
End If
If oPara.Range.Style = "LE" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Style = "XL" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Style = "MF" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Style = "HG" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Style = "LW" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Style = "J8" Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
' Agarrando texto sin estilo >_>
If oPara.Range.Font.Size <= 6 Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(main) "
End If
End If
If oPara.Range.Font.Size = 8 Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(capara) "
oPara.Range.InsertParagraphBefore
oPara.Range.InsertBefore "(start) "
End If
End If
If oPara.Range.Font.Size = 10 Then
If InStr(1, oPara.Range.Text, "(intro)") = 0 And _
InStr(1, oPara.Range.Text, "(main)") = 0 And _
InStr(1, oPara.Range.Text, "(capara)") = 0 Then
oPara.Range.InsertBefore "(intro) "
End If
End If
Next oPara
'Con esto borramos el primer espacio del documento (evitamos una línea demás en los edictos)
Selection.HomeKey Unit:=wdStory
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCharacter, Count:=8
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
'Crea el .txt para ser importado a Tera
ChangeFileOpenDirectory "C:\edictos\"
ActiveDocument.SaveAs FileName:="C:\edictos\Edictos.txt", FileFormat:= _
wdFormatText, AddToRecentFiles:=True, _
WritePassword:="", EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, Encoding:=1252, InsertLineBreaks:=False, AllowSubstitutions:=False, _
LineEnding:=wdCRLF
MsgBox "Proceso completado", 0, "Yay!"
ActiveDocument.Close
End Sub
As you see, it ends up saving a .txt document with the tags.
NOW... the issue is that the tags wont work anymore in the new system, and I need to wrap the paragraph in XML Tags. I tried to do something like for styles:
If oPara.Range.Style = "LW" Then
If InStr(1, oPara.Range.Text, "<intro>") = 0 And _
InStr(1, oPara.Range.Text, "<main>") = 0 And _
InStr(1, oPara.Range.Text, "<capara>") = 0 Then
oPara.Range.InsertAfter "</main> "
oPara.Range.InsertBefore "<main> "
End If
End If
But it just would add the two tags before the paragraphs!!! Is there anyway to wrap the paragraph in XML tags, following my logic? Somebody help please!! Thank you!! :/Hi,
Sorry for my delay.
I am afraid that this is not the proper forum for this issue, and I found that you have posted it in dedicated forum.
http://social.msdn.microsoft.com/Forums/office/en-US/8dad5670-d90b-4ea8-abe2-bc785a2368ca/problem-trying-to-wrap-a-microsoft-word-paragraph-in-xml-tags-?forum=worddev#8dad5670-d90b-4ea8-abe2-bc785a2368ca
I would suggest you focus on that thread to get more dedicated support.
Thanks for your understanding.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Report for editing the word document with xml tags
Hi all,
My requirement is to edit the contents of the word document in the presentation server through report programming and save that document in the presentation server.
For eg if my word document contains many xml tags with spaces < EDI_DS40 >, i would like to remove the spaces and i want it to be lyk <EDI_DS40>.Then say if i wanted to make some modification (addition, deletion,replacing with some text) in the text in some nth line of the document how can dis be dione.
Is there any function module or bapi which serves this purpose.
Can anyone pls guide me on dis.
Thanks & Regards,
Revathi.Hi,
just to let you know I have sorted this.
http://macintoshhowto.com/leopard/how-to-merge-pdf-files-with-preview-in-leopard .html
Thanks. -
How to read an attribute of an xml tag in jsp.
hi guys,
This is murali krishna. i have a small problem,
i have one xml file (books.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<library>
<book id="1">
<name>Head First Java, 2nd Edition</name>
<author>Kathy Sierra and Bert Bates</author>
<publication-date>09-Feb-2005</publication-date>
</book>
<book id="2">
<name>Effective Java</name>
<author>Joshua Bloch</author>
<publication-date>28-May-2008</publication-date>
</book>
<book id="3">
<name>Java How to Program, 7th Edition</name>
<author>Harvey M. Deitel and Paul J. Deitel</author>
<publication-date>6-Jan-2007</publication-date>
</book>
</library>
I tried to read this xml file in jsp as shown below
<%@ page language="java" %>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="javax.xml.parsers.DocumentBuilder" %>
<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
<%
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
DocumentBuilder db =dbf.newDocumentBuilder();
Document doc=db.parse("c:\\books.xml");
NodeList nl = doc.getElementsByTagName("book");
%>
<html>
<head>
<title>How to read XML file in JAVA</title>
</head>
<body>
<%
for(int i=0;i<nl.getLength();i++)
NodeList nameNlc= doc.getElementsByTagName("name");
Element nameElements=(Element)nameNlc.item(i);
String nameTagValue=nameElements.getChildNodes().item(0).getNodeValue();
NodeList authorNlc= doc.getElementsByTagName("author");
Element authorElements=(Element)authorNlc.item(i);
String authorTagValue=authorElements.getChildNodes().item(0).getNodeValue();
NodeList dateNlc= doc.getElementsByTagName("publication-date");
Element dateElements=(Element)dateNlc.item(i);
String dateTagValue=dateElements.getChildNodes().item(0).getNodeValue();
out.println("name :"+nameTagValue+"<br>");
out.println("author :"+authorTagValue+"<br>");
out.println("publication-date :"+dateTagValue+"<br><br>");
%>
</body>
</html>
so, my problem is I was unable to read the attribute of the tag book , that is "id".
can any one tell me how to read this "id" attribute.
Murali Krishna
[email protected]hi,
U r retriving the elements by tag name.So it just chks the tag name ie.<book> & gives u array of elements.But u need retrive d attribute of <book> tag itself.
=Solution =====
Add one more statement ----> var[]= doc.getElementsByName("book");
Now u hav book elements as an array & can retrive id in for loop
for(var; var.length;var++)
doc.element[var].id.value -
How to import images with path embedded in XML tag
I have a website that has blogs with embedded images. I need to design an XML that can be imported in Indesign. I am able to import XML and lay it out in Indesign if I have only text. But I am not able to include or show the intermittent, embedded images in Indesign. Can this be done? -Thanks
I can drag an image from, for example, the desktop, but if I delete that file on the desktop I won't be able to open that image in iPhoto, even if I've imported it
That's an indication that you may have your library set up as a referenced library:
Check the Advanced preferences in iPhoto to see if that checkbox is selected or not. If it isn't checkec, check it and try importing agan.
To make sure all Photo Stream photos are automatically imported into your library set up iPhoto's PS preferences like this:
You should read this User Tip by Terence Devlin which is the best treatise on how to access photos (for use outside of iPhoto): How to Access Files in iPhoto
OT -
Is it possible to insert image that is embedded in XML tag value?
Hello,
I am trying to import a blog XML. Blogs can have images in their bodies. So can I have this image imported and placed in content place holder along with other text in the XML? I am using import XML here....thanksI don't know that it's a flaw just because it's not the way you want it. That appears to be just how the app is. That's not a bad idea, though. You could give Apple feedback here and suggest it: Apple - Mac OS X - Feedback
-
How to read duplicate XML tag?
Hi to all gurus,
Currently I am working on XSLT transformation. I encountered a problem when I have to read a random number of xml tag with the same names.
sample:
<product_code_list>
<product_code>12345</product_code>
<product_code>12333</product_code>
<product_code>12233</product_code>
</product_code_list>
My xslt can only manage to read the 1st row. How can it be possible to read all the 3 rows?
xslt:
<product_code_list>
<xsl:for each select-value-of='product_code_list'>
<product_code_list1>
<product_code><xsl: select-value-of ='product_code'></product_code>
</product_code_list1>
</xsl:for each>
</product_code_list>
Many thanks in advance for reading this. Please assist to solve this. Point will be generously awarded!Hi Mr Raja!
Thanks again for your help. I felt so embarrassed.
The product is produced from another source dynamically. Hence the list can contain from 1 to any number of products.
I tried to use the for-each but another problem arise. the structure is created for the products, but it is all empty inside when i used the debugger to go through the code.
TYPES:
TPRODUCT(10) OCCURS 0,
BEGIN OF PRODUCT_LIST,
PRODUCT TYPE TPRODUCT,
END OF PRODUCT_LIST,
PL TYPE PRODUCT_LIST OCCURS 0.
DATA:
VENDOR TYPE STANDARD TABLE OF PRODUCT_LIST INITIAL SIZE 0,
XML_STRING TYPE STRING,
xslt_error TYPE REF TO cx_xslt_exception,
xslt_message TYPE string.
CLEAR xml_string .
CONCATENATE
`<myXML>`
`<PRODUCT_LIST>`
`<PRODUCT>12345</PRODUCT>`
`<PRODUCT>12333</PRODUCT>`
`<PRODUCT>62233</PRODUCT>`
`</PRODUCT_LIST>`
`</myXML>`
INTO XML_STRING.
CLEAR VENDOR.
TRY.
CALL TRANSFORMATION ('ZTESTCHINXSLT')
SOURCE XML XML_STRING
RESULT VENDOR = VENDOR.
CATCH
cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ENDTRY.
XSLT:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/abapxml" version="1.0">
<xsl:template match="/">
<asx:abap xmlns:asx="http://www.sap.com/abapxml">
<asx:values>
<xsl:for-each select="myXML">
<VENDOR>
<xsl:for-each select="PRODUCT_LIST">
<PRODUCT_LIST1>
<PRODUCT>
<xsl:for-each select="PRODUCT">
<P>
<xsl:value-of select="PRODUCT"/>
</P>
</xsl:for-each>
</PRODUCT>
</PRODUCT_LIST1>
</xsl:for-each>
</VENDOR>
</xsl:for-each>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Message was edited by:
swee chin -
Attaching XML tags to paragraphs (CS2/VB)
Hi everybody,
I need to build an Indesign document from several Word documents, attach XML tags to those document parts and also to retain Word's paragraph styles.
I use temporary textframes and copy & paste to put the Word stuff together into one large textframe. Works fine so far. Paragraph styles remain intact:
InDesign.XMLElement xch = root.XMLElements.Add("XML_" + Convert.ToString(cnt), "");
InDesign.InsertionPoint ip = (InDesign.InsertionPoint)txt.InsertionPoints.LastItem();
ip.Select(InDesign.idSelectionOptions.idReplaceWith);
id4.app.Paste();
But as soon as I call Markup() to add the XML tag to this part of the document, all paragraph style information gets lost:
ip.Markup(xch);
This is most certainly some kind of RTFM error, but since there's no really detailed documentation for scripting (at least I couldn't find one yet - hints are welcome), I'm stuck.
Thanks a lot.
HansHi Hans,
The InDesign CS2 Scripting Guide and Scripting Reference PDFs are on your InDesign CS2 installation CDs.
Many things in scripting did not change between CS2 and CS3--and there are more XML examples in the CS3 version of the Guide (though you should note that CS2 does not have the XML rules feature at all). You can find the InDesign CS3 Scripting Guide: VBScript at:
http://www.adobe.com/products/indesign/xml_scripting.html
(you'll need to click the Scripting Resources tab to get to the relevant page)
The Markup.vbs example script (a fragment is shown on page 119 of the Guide; you can find the full script in the associated Zip archive of scripts) shows you the general approach to marking up page items or text. The basic form is:
Rem Where "myXMLElement" is a reference to an XML element
Rem and "myText" is a reference to a text object...
myXMLElement.markup myText
Here's a more complete script (VBScript form):
Rem MarkupText.vbs
Rem An InDesign CS2/CS3 VBScript
Rem
main
Function main()
Rem Use "InDesign.Application.CS2" to target CS2
Set myInDesign = CreateObject("InDesign.Application.CS3")
mySetup myInDesign
mySnippet myInDesign
End Function
Rem mySetup function creates an example document.
Function mySetup(myInDesign)
Set myDocument = myInDesign.Documents.Add
Rem Create some paragraph styles.
Set myBodyText = myDocument.ParagraphStyles.Add
myBodyText.Name = "BodyText"
Set myHeading = myDocument.ParagraphStyles.Add
myHeading.Name = "Heading"
myHeading.PointSize = 24
Rem Add XML elements
Set myRootXMLElement = myDocument.XMLElements.Item(1)
Set myXMLTag = myDocument.XMLTags.Add("xml_element")
Set myXMLElementA = myRootXMLElement.XMLElements.Add(myXMLTag)
Rem Create a text frame
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myTextFrame.GeometricBounds = myGetBounds(myDocument,myDocument.Pages.Item(1))
myString = "This is the first paragraph in a text frame." & vbCr
myString = myString & "This is the second paragraph in a text frame." & vbCr
myString = myString & "This is the third paragraph in a text frame." & vbCr
myString = myString & "This is the fourth paragraph in a text frame." & vbCr
myTextFrame.Contents = myString
Rem Use ApplyParagraphStyle in CS3.
myTextFrame.Texts.Item(1).ApplyStyle myBodyText
myTextFrame.Paragraphs.Item(1).ApplyStyle myHeading
End Function
Rem mySnippet shows how to use the XMLElement.Markup method.
Function mySnippet(myInDesign)
Set myDocument = myInDesign.Documents.Item(1)
Rem Have to associate the Root XML element with the story
Rem before associating child elements.
myDocument.XMLElements.Item(1).Markup myDocument.Pages.Item(1).TextFrames.Item(1)
Rem Now we can associate XML elements with individual paragraphs.
Set myXMLElement = myDocument.XMLElements.Item(1).XMLElements.Item(1)
Set myText = myDocument.Pages.Item(1).TextFrames.Item(1).Paragraphs.Item(1)
myXMLElement.Markup myText
End Function
Rem Utility function for getting the bounds of the "live" area
Rem (the area inside the page margins) of a page.
Function myGetBounds(myDocument, myPage)
myPageWidth = myDocument.DocumentPreferences.PageWidth
myPageHeight = myDocument.DocumentPreferences.PageHeight
Rem Page.Side is a CS3 property. In CS2, use:
Rem If myPage.DocumentOffset Mod 2 = 0 Then
If myPage.Side = idPageSideOptions.idLeftHand Then
myX2 = myPage.MarginPreferences.Left
myX1 = myPage.MarginPreferences.Right
Else
myX1 = myPage.MarginPreferences.Left
myX2 = myPage.MarginPreferences.Right
End If
myY1 = myPage.MarginPreferences.Top
myX2 = myPageWidth - myX2
myY2 = myPageHeight - myPage.MarginPreferences.Bottom
myGetBounds = Array(myY1, myX1, myY2, myX2)
End Function
As to style information getting lost--it probably has to do with your Tag to Style/Style to Tag mapping. The above script demonstrates that it is possible to mark up text without losing the style.
You might also consider using tag to style or style to tag mapping after pasting the text from Word.
Hope this helps!
Thanks,
Ole -
Embedding inline HTML data in XML using the mx:XML tag with <; and >;
What is best practice for embedding HTML within the
<mx:XML> tag? Programmatically, I can implement this
successfully:
[Bindable]
public var xmlDP:XML = <component data="<" />;
However, I get the following error if I try to store the same
data inline in an mx:XML tag, as such:
<mx:XML id="xmlDP">
<component data="<" />
</mx:XML>
Error #1095: XML parser failure: Unterminated attribute.
If I change the MXML tag as follows, it works fine:
<mx:XML id="xmlDP">
<component data="&lt;" />
</mx:XML>
Unfortunately, I also can not source the mx:XML tag to an XML
file which uses < or > codes, as it yields the same
results. This leads me to believe that the <mx:XML> tag does
not support the special character codes for < and >, but why?
Incidentally, this code also gives a 1095 error:
<mx:XML id="xmlDP">
<component data="<" />
</mx:XML>
This is causing an issue with my source data as it is not
hand typed into Flex, and standard XML supports the < and
> codes. I have tried a full HTML string, as shown below,
but this also generates the error:
<mx:XML id="xmlDP">
<component data="<b>Test</b>"
/>
</mx:XML>
Many thanks for any input you may have!I’m generating the XML source file with
Microsoft’s XML Notepad 2007. It will encode invalid special
characters automatically. My understanding is that this is the
proper way to handle the less than symbol in a XML string, that is
to say using the < code.
With respect to the escape and un-escape methods, I am able
to successfully implement these in AS, but not in MXML. This makes
sense considering they are AS methods, but I was hoping to be able
to do something like:
<mx:XML id="xmlDP">
<component data="escape('<');" />
</mx:XML>
This gives the following compilation error:
The value of attribute "data" must not contain the '<'
character.
As does using the escape character as such:
<mx:XML id="xmlDP">
<component data="\<" />
</mx:XML>
Below is an example of what the escape character may be used
for in AS:
var myString:String = "\"";
trace(myString);
// result: "
Likewise, I can escape the < character as such:
var myString:String = escape("<");
trace(myString);
// result: %3C
<mx:XML id="xmlDP">
<component data="%3C" />
</mx:XML>
trace(un-escape(xmlDP.@data));
// result: <
As you can see, using %3C and unescaping in AS will yield the
correct result; however, this is not a practical method of
representing the data in MXML as I would have to write an AS method
to un-escape the XML string anyway, so I might as well just store
the data in AS to begin with. I was hoping for a way to source an
mx:XML object, without having to load it into ActionScript
manually. Here’s an example of the functionality I would
expect:
<mx:XML id="xmlDP">
<component data=">" />
</mx:XML>
trace(xmlDP.@data);
// result: >
Only this does not work for the less than symbol. I’m
assuming at this point that this is a bug in the Flex compiler.
Thanks again for your help troubleshooting this one! -
Add xml tag to specific words in a text frame
Dear all,
I'm pretty sure this can't be too much of a hassle, but after hours of experimenting, searching and reading I can't seem to look at it from the right angle. I'm trying to find a way to search for a specific word ('Figure', in my case) in a given text frame, and add a corresponding XML tag to it automatically. I've found plenty of information on how to apply it to a page item as a whole, but from there no approach seems to work. Seeing as I'm fairly new to InDesign scripting, any nudge in the right direction would be an immense help.
Kind regards and thanks in advance,
JulianHi Julian,
Is this you asking?
var doc = app.activeDocument;
app.findTextPreferences.findWhat = "figure";
var found = doc.findText();
for(var i =0;i<found.length;i++)
doc.xmlElements[0].xmlElements.add({markupTag:"figure", xmlContent:found[i]});
Regards,
Chinna -
Reading a xml file and Extract content of xml tags
Hi,
I need a InDesign script to Extract content of xml tags by reading a local xml file. And stamping the content of xml on InDesign Text frame.
My sample xml is as follows .
<events type="array">
<event>
<aktiv_jn>J</aktiv_jn>
<enetpulse_id>1712408</enetpulse_id>
<event_id>65974</event_id>
<hjemmehold>AZ Alkmaar</hjemmehold>
<id>93</id>
<kickoff>2014-08-17T12:30:00+01:00</kickoff>
<land_id>140</land_id>
<land_navn>Holland</land_navn>
<liga_id>13684</liga_id>
<liga_navn>Eredivisie</liga_navn>
<livebetting_jn>J</livebetting_jn>
<marked_id>2897740</marked_id>
<marked_nummer>138</marked_nummer>
<marked_tekst>AZ Alkmaar - Ajax</marked_tekst>
<moderkamp_jn>J</moderkamp_jn>
<ob_bet_type>MR</ob_bet_type>
<odds_1>2.95</odds_1>
<odds_2>2.25</odds_2>
<odds_x>3.35</odds_x>
<program_slut>2014-08-18T23:59:00+01:00</program_slut>
<program_start>2014-08-15T00:00:00+01:00</program_start>
<resultat>2</resultat>
<spilstop_dato_tid>2014-08-17T12:30:00+01:00</spilstop_dato_tid>
<sport_id>21</sport_id>
<sport_navn>Fodbold</sport_navn>
<taerskel nil="true"/>
<udehold>Ajax</udehold>
<udfald_1_id>9661951</udfald_1_id>
<udfald_2_id>9661953</udfald_2_id>
<udfald_x_id>9661952</udfald_x_id>
</event>
</events>
And on my Indesign Page upon execution of script: I need text like,
land_navn: Holland
odds_1: 2.95
odds_2: 2.25
odds_x: 3.35Hi,
Try: -
Embedding html in xml tags, when rednering text as html
Quick question,
I have a site that reads all content from an external xml.
The text box that reads this info renders the content as html; does
anyone know how to go about putting an html tag in an xml tag so
that flash can read it?
So would it be possible to do:
<content>
" Welcome to the site<br>we are happy to have you
here<br><img src="logo.jpg"> "
</content>I completed deleted the old way, so I have to recreate this
from scratch...but here is how I used to be able to do it (which,
looking at how I do it now since HTML wasn't parsing, this was so
stupid).
<chair id="1" price_point="High-end">
<image><a
href='/dsn/catalog/viewproductpage.asp?OwnerID=1&PageID=%7B7A0FB858%2D2184%2D4033%2DB 474%2D2B22D89BBD96%7D'><img
src='/images/s/dshe/mini/7/79219.jpg border='0'
/></a></image>
<description><a
href='/dsn/catalog/viewproductpage.asp?OwnerID=1&PageID=%7B7A0FB858%2D2184%2D4033%2DB 474%2D2B22D89BBD96%7D'>Toni</a></description>
<brand>Kwalu</brand>
<composition>Kwalu</composition>
<leg_style>Chippendale</leg_style>
<overall_style>Transitional</overall_style>
</chair>
And now in 1.1, having that, it prints this on screen:
<a
href='/dsn/catalog/viewproductpage.asp?OwnerID=1&PageID=%7B7A0FB858%2D2184%2D4033%2DB474% 2D2B22D89BBD96%7D'><img
src='/images/s/dshe/mini/7/79219.jpg border='0' /></a>
whereas before, it would be that image and it would link to
the page specified in the href.
I'm about to take off from work for the night, but I'll check
back when I get home if you need anything else from me.
Thanks for your help, Kin. :)
Kyle -
How to read content between xml tags?
is there any way to read the content between xml tag
> is there any way to read the content between xml tag
Yes. Are you having some sort of problem? If so, please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
Please post a short, concise, executable example of what you're trying to do. Don't post the actual code you are using (I can't emphasize this strongly enough). Just write a small example that demonstrates the problem, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
Help us help you solve your problem.
~ -
How to Read XML tags....
Hi guys...
Can any one here tell me how to read the XML tag in PL/SQL.
In table Enquiry there are following fields.
Id number
Status varchar2(5)
Request XML
Reply XML
Error varchar2(10)
Now the following XML will be in request column from the requester.
I have to get the,
->request which is in BODY tag,
->ID number which is in from tag (its the persons unique ID to check his BILL)
Fetch the request from the database and updates it into the REPLY field with the same syntax.
<message>
<to> 123 </to>
<from>789</from>
<body> unbill </body>
<messagenumber> 01 </messagenumber>
</message>
Can any one have the solution to this, how can I read the XML tags, process & again inserts as an XML.
Thanks.Maybe something like this will be a pointer...
SQL> CREATE TABLE t AS
2 select 1 as id, 'C' as status, XMLTYPE('<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>') as request, XMLTYPE('<reply/>') as reply, 'NO ERROR' as error from dual
3 ;
Table created.
SQL>
SQL> SELECT * from t;
ID S
REQUEST
REPLY
ERROR
1 C
<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>
<reply/>
NO ERROR
SQL>
SQL> UPDATE t
2 SET reply = updateXML(request,'/message/body/text()','bill')
3 ;
1 row updated.
SQL>
SQL> SELECT * from t;
ID S
REQUEST
REPLY
ERROR
1 C
<message><to>123</to><from>789</from><body>unbill</body><messagenumber>01</messagenumber></message>
<message><to>123</to><from>789</from><body>bill</body><messagenumber>01</messagenumber></message>
NO ERROR
SQL> -
Hi,
I have the below XML
<RESULTS>
<ROW>
<COLUMN NAME="ID">12688f8ac8aa6310VgnVCM10000078ccc70a____</COLUMN>
<COLUMN NAME="BRANCH_NAME">Brooklyn</COLUMN>
</ROW>
</RESULTS>
Could somebody please assist me with a way to read the XML tags alone from this. We do not require the data as such.
A query on this XML should return
RESULTS
ROW
COLUMN NAME and so on ...
Regards,
Jiteshforum has many examples
like Re: multiple xml tag values are not getting in output.
Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
Connected as apps
SQL>
SQL> with t as
2 (select xmltype('<RESULTS>
3 <ROW>
4 <COLUMN NAME="ID">12688f8ac8aa6310VgnVCM10000078ccc70a____</COLUMN>
5 <COLUMN NAME="BRANCH_NAME">Brooklyn</COLUMN>
6 </ROW>
7 </RESULTS>') xml
8 from dual)
9 select x.*
10 from t,
11 xmltable('for $i in $d/descendant::*
12 return element r {
13 element tag_name {local-name($i)}, element tag_name2 {name($i)}
14 }' passing t.xml as "d" columns tag_name
15 varchar2(30) path 'tag_name',
16 tag_name2 varchar2(30) path 'tag_name2') x
17 /
TAG_NAME TAG_NAME2
RESULTS RESULTS
ROW ROW
COLUMN COLUMN
COLUMN COLUMN
SQL>
Maybe you are looking for
-
Marketplace widget does not work after update
Updated phone (Droid X) this morning (10-24-10). Seemed to go fine until I clicked on what was supposed to be the marketplace widget. It said something to the effect that the application was not installed. The usual Icon was replaced by a blue ico
-
Ideas for a new product: Combining RMI, JMS, ...
Hello! I am an experienced Java programmer trying to think of a mid-sized (i.e., less than 10,000 lines of code) project that uses remote computing (RMI and the like) and JMS to create a product that would be of frequent utility. I have some ideas bu
-
Error while running index creation
Hi All , I am running index creation step like below . alter session enable parallel DDL; alter session set workarea_size_policy=manual; alter session set sort_area_size=250000000; alter session set db_file_multiblock_read_count=128; CREATE INDEX "CU
-
I have been provided with a report that requires the parameter field to be populated with the word u2018Weeku2019 and followed by the week number i.e. Week 02 I have an automated system for exporting reports via email, and I can set the parameters to
-
Can anyone out there assist me in opening a few PM5 files? When I try with Page Maker 7 in Windows, it fails with an error along the lines of the file cannot be converted to a PC format and to a new version at the same time. I tried installing page m