[CS3 JS] XML markup with a loop
Hello,
I'm creating a script that outputs a calendar list for a month into a textframe in Indesign. I would like to have each line (representing a day) marked up with a tag (monday to tag "monday").
I'm using the function below, but i is not creating a XML element for each line/day, instead it creates one xmlelement and updates it.
Can anyone guide me here?
I have tried to read the manual, i have read other topics like //MarkupTextWithGrep.jsx by Olav Kvern, but i just cant make this work.
function monthlist(item, date, xmlElm) { // Item is a textframe, date is a date object, xmlElm is the textframes associatedXMLElement
item.contents = "";
var count = 0;
for (cur_date = new Date(date.getFullYear(), date.getMonth(), date.getDate()); cur_date.getMonth() == date.getMonth(); cur_date.setDate(cur_date.getDate()+1)) {
if(count != 0) {
item.contents += "\r"
item.contents += "\t" + cur_date.getDate();
// xmlMarkup(cur_date.getFullDay(),item.lines.lastItem());
// Create the xml tag if it does not already exist.
try{
myXMLTag = act_doc.xmlTags.item("_" + cur_date.getDay().toString());
myXMLTag.name;
catch (myError){
myXMLTag = act_doc.xmlTags.add("_" + cur_date.getDay().toString());
xmlElm.xmlElements.add(myXMLTag, item.lines.lastItem());
count++;
Any one?
Similar Messages
-
Strip off markups of generic XML data with E4X
I have a generic XML file:
<nodes>
<node1 att1='abc' att2='xyz'>
<ele1> Hello </ele1>
<ele2> Hi </ele2>
</node1>
</nodes>
The tag and attribute names above can be anything. I need a
generic method to strip off the XML markups and display the
contents as:
node1@att1: abc
node1@att2: xyz
node1.ele1: Hello
node1.ele2: Hi
How can E4X do this?e4x is for manipulating/navigating your xml. But you can use
it inside a for/each loop to look at your xml nodes and extract the
strings without the xml tags using toString().
Search the help docs for "XML type conversion" and see the
toString() method in action. -
Weird problem with loading data from an XML using a for loop
Hi,
I have a strange problem. I have encountered this thing many a times but still don't know the proper workaround for it.
I am trying to load swf file, a video file or an image. They can be present on a local system or on a remote server also. All the entries corresponding to the files to be loaded is made in an XML file. I traverse through the nodes of the XML using a for loop. On the complete event of loader info, example:.
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
I fill a container with the loaded data.
My problem is when I am using for loop it doesn't works properly but if i use a statement like this:
someFunc()
if(i<arr.length())
... do something...
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
private function onComplete(e:Event):void
... do something...
i++;
All files are loaded properly.
I think this can be because the for loop processes pretty fast but the content takes time to load, which ultimately leads to some wierd results.
Please let me know how can this thing be done correctly by using a for loop also.You don't want to use a for loop to load several items. The way you almost appear to have it is the proper approach... load a file and use the completion of its loading to trigger loading the next file.
-
Create xml file with nested internla table or with header & item tables
Hi I have a requirement like, I need to create an xml file for header and item details. For 1 header there may be multiple line items.
I did search in forums some where I came to know that we can use XSL:IF to achieve this. but I could not able to do this.
I tried with using nested internal tables also but now luck.
can anybody please suggest how can we create xml for header and item detials.
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:asx="http://www.sap.com/abapxml"
exclude-result-prefixes="asx"
>
<xsl:template match="/">
<OrbisomRequest>
<xsl:attribute name="Version">
<xsl:value-of select="11.1"/>
</xsl:attribute>
<xsl:attribute name="IssuerID">
<xsl:value-of select="1"/>
</xsl:attribute>
<xsl:for-each select="asx:abap[1]/asx:values[1]/T_FINAL[1]/*">
<CreateApprovedPurchaseRequest
RerquestID="{VBLNR}"
CommonName="User1"
Amount="{WRBTR}"
Comment="TestComment"
CurrencyCode="978"
PurchaseType="All"
SupplierName="All"
VCardAlias="PurchaseCard"
ValidFrom="1M"
CurrencyType="B">
<CDFs>
<Invoice> <xsl:value-of select="BELNR"/> </Invoice>
<Amount> <xsl:value-of select="WRBTR"/> </Amount>
</CDFs>
</CreateApprovedPurchaseRequest>
</xsl:for-each>
</OrbisomRequest>
</xsl:template>
</xsl:transform>
here belnr and wrbtr will be my item details. for each payment document I can have multiple invoices. in CDF I need to display the invoices for that particular payment document.
what conditions can I put there before CDFs to make the item internal table to loop based on header internal table.
Regards,
Ranganadh.Looks like you have already created the transformation "Z_ID"
Take a look at the following thread, it answers many of the questions you have asked:
[ABAP data to XML conv with UTF-8 encoding and custom namespace|Re: ABAP data to XML conv with UTF-8 encoding and custom namespace;
Che -
Update passed in XML doc with pl/sql xmldom
Hi,
I have an xml document that is passed in through a stored procedure as CLOB. I'm trying to use the XMLParser and XMLDOM to add an additional node
The XML looks something like the following
<rowset>
<row>
<firstname>john</firstname>
</row>
<row>
<firstname>jane</firstname>
</row>
</rowset>
I need to loop through each of <mynames> nodes and then add another node <lastame> so it looks like the following
<rowset>
<row>
<firstname>john</firstname>
<lastame>smith</lastame>
</row>
<row>
<firstname>jane</firstname>
<lastame>smith</lastame>
</row>
</rowset>
I have the following code
parseClob XMLPARSER.Parser;
newNames XMLDOM.DOMDocument;
tempNode XMLDOM.DOMNode;
mye xmldom.domelement;
item_text xmldom.DOMText;
numofrows number;
nodeList xmldom.DOMNodeList;
newnode xmldom.domnode;
parseClob := xmlparser.newParser;
XMLPARSER.parseClob(parseClob,names);
newNames := XMLPARSER.getDocument(parseClob);
XMLPARSER.freeParser(parseClob);
nodeList := xslprocessor.selectNodes(xmldom.makeNode(newNames), '//rowset/row');
numOfRows := xmldom.getlength(nodeList)-1;
for i in 0..numOfRows LOOP
newnode := xmldom.item(nodeList, i);
--create the new node
mye := xmldom.createElement(newName, 'lastname');
--add it to the new node
tempNode := xmldom.appendChild(newnode, xmldom.makeNode(mye));
--update the text in the lastname
item_text := xmldom.createTextNode(newNames, 'smith');
tempNode := xmldom.appendChild(tempNode, xmldom.makeNode(item_text));
end loop;
what happens is that when i write out the newnode xml out to a buffer i see the <lastname> tag
but when i write out the newNames xml out to a buffer after the loop is finished the <lastname> tag is
missing. like it didn't update the newNames xml
I've seen lots of example on how to create an XML document with the DOM from scratch but nothing about updating
an passed in xml document. any help would be appreciatedUpdatexml is reference in Oracle 9i, I'm sorry i should have mentioned that I am using oracle 8i. Is there something you can use in oracle 8i?
-
Problems with reading XML files with ISO-8859-1 encoding
Hi!
I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
Here's the code:
import java.io.File;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.net.*;
* @author gustav
public class RSSDocument {
/** Creates a new instance of RSSDocument */
public RSSDocument(String inurl) {
String url = new String(inurl);
try{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(url);
NodeList nodes = doc.getElementsByTagName("item");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
System.out.println("Title: " + getCharacterDataFromElement(line));
NodeList des = element.getElementsByTagName("description");
line = (Element) des.item(0);
System.out.println("Des: " + getCharacterDataFromElement(line));
} catch (Exception e) {
e.printStackTrace();
public String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
return "?";
}And here's the error message:
org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at getrss.RSSDocument.<init>(RSSDocument.java:25)
at getrss.Main.main(Main.java:25)I read files from the web, but there is a XML tag
with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s). -
One to many xml files with file adaptor
Hi,
I have a scenario HCM-ABAPProxy--XI-File for one structure I need to generate multiple xml files with 100 records per file.
this is my input messag
MT_in
Node
PositionIDs
descrption
job
IsActive
what I was doing on the ABAP side for every node I have 100 PositionID's sub nodes. so each node should be a sperate file.
my output structure is
PositionIDs
PositionID
pid
description
job
so there should be one PositionIDs per file which contains 100 PositionID.
I've multi message mapping without BPM that did not work out just wondering if any one came across the same scenario.
thanks,
JoeYou can not create multiple files without BPM. You can pretty much perform multi mapping to achieve your split but to write it to a file, you will have to call the file adapter for each split which you can not do without using BPM. In BPM, for each split that you perform, you can use a send step in for-each loop which will give you the functionality you require.
Award if helpful,
Sarath. -
CS3 javascript XML and attribute adding.
I've been trying to get something working in CS3 javascript XML for some time and it is getting really frustrating.
Say I have:
var someXML = new XML("<anElement/>");
someXML.@xxx = "something";
$.writeln(someXML.toXMLString());
gives the output I'd expect (<anElement xxx="something"/>);
But I need the name of the attribute to be dynamic. As far as I can see I should be able to either:
someXML.getAttribute("xxx") = "something";
or
someXML.@["xxx"] = "something";
both these cases give an error of 'Cannot set property xxx'. I'm using CS3 version 5.0.4 (the debug build because most of the time I'm working directly with the API - not through scripting).
I looking for ideas to try...
IanHi Ole, thanks for the reply.
I am aiming to manipulate XML using standard javascript functions - nothing directly to do with indesign, though other parts of the script does interact with it. Basically the scripts allow a user to set some configuration options and that is in an XML string format (if it was the indesign XML Hierarchy XMLElements, etc I'm pretty sure I could get things to work - worst case I could add to the scripting support in a plugin and make it work...).
I had an idea (driving home after a frustrating day), Since the XML I'm processing is small, I can move forward by crudely making a string from the XML object, inserting the attribute into the string and then re-new'ing the XML object. With large comments about why - unless someone can come up with a reason/fix for the javascript-XML not working (I suppose it may just be the number of InDesign/Extendscript versions I have installed - CS2/CS3/CS4, indesign and server).
Ian -
Validation of TLF-Markup with DTD?
Hi everyone,
we're using TLF to display structured text on the client side with Flex. The text comes from a database where it is stored in our own XML-Markup, transformed on the server side (java server) to TLF-Markup and then sent to the client.
Is there any possibility to make sure that the transformation on the server into TLF-XML results in a valid syntax so that the RichText component can display it? Something like a DTD for the TLF-Markup?
Thanks in advance!Object Hierarchy
Parent ->
Child
TextFlow
div
p
a
tcy
span
img
br
tab
list
li
g
TextFlow
no
no
no
no
no
no
no
no
no
no
no
no
div
yes
yes
no
no
no
no
no
no
no
yes
yes
no
p
yes
yes
no
no
no
no
no
no
no
yes
yes
no
a
no
no
yes
no
yes
no
no
no
no
no
no
yes
tcy
no
no
yes
yes
no
no
no
no
no
no
no
yes
span
no
no
yes
yes
yes
no
no
no
no
no
no
yes
img
no
no
yes
yes
yes
no
no
no
no
no
no
yes
br
no
no
yes
yes
yes
no
no
no
no
no
no
yes
tab
no
no
yes
yes
yes
no
no
no
no
no
no
yes
list
yes
yes
no
no
no
no
no
no
no
yes
yes
no
li
no
no
no
no
no
no
no
no
no
yes
no
no
g
no
no
yes
yes
yes
no
no
no
no
no
no
yes
For formats, it's more comlicated. You can ask some specific formats. -
XML generation with SAP data using XML schema - Reg
Hello experts,
My requirement is , SAP( ztable data ) data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
Generating XML file with their Schema should be underlined.
I studied that call transformation statement helps for this.
Even then i don't have clear idea about this topic.
Please brief me about how to use their XML schema to generate XML with my own sap data.
Thanks in advance experts.
Kumarplease try this same program and see it ....
*& Report z_xit_xml_check
REPORT z_xit_xml_check.
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
reward points if it is use fulll ....
Girish -
XML validation with DTD in java 1.5 not supporting
Hi,
I am facing a problem regarding validation of xml file with DTD tag in it.
I have disabled the parser through setValidating(false) method.
xml file is not parsed in JRE 1.5.but it is parsed in JRE 1.6.
Why this is showing such a behavior?
I have used xerces 2.9.0,xml-api.jar and other jar regarding XML api but still it is giving error.
please help me.
please provide a jar file name or its issue resolution in jre 1.5 or 1.4.thanks for your prompt reply.
I required that it should be completely disabled in jre 1.5(jdk1.5 or 1.4).
I am using DOM Parsing.I have currently disabled with follwowing method,
builderFactory.setValidating(false);
builderFactory.setFeature("http://xml.org/sax/features/validation",
false);
builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
builderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
builderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
in 1.6 it is working fine but I required that i have to disabled it.but it is giving a error in jre1.5.
Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
I just want to disable the parsing in jdk version 1.5 or 1.4
thanks in advance
anand -
How can I save a XML file with JAXP1.1?
Dear All.
I write a program to create XML file with DOM model, but I can't know how to save it? My environment is JAXP1.1 and JDK1.3.1,I has been required not use other XML parser toolkits,only JAXP1.1.
How can I do? thank you.
Many person give me a idea the com.sun.xml.tree.XmlDocument, but I can't find the class in API document or JAXP1.1's packages. why?
what is it? How can i use it?
thank you very much.The way to save an XML Document is using a Transformer.
To have access to a transformer use the packages :
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
Then for saving your Document Object (named dXml) get a Transformer Object with the TransformerFactory Object :
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
Now you have got your Transformer Object, to save your Document Object use the method :
Document dXml = getMyDocument(); // this is your Document Object.
OutputStream osSave = getMySaveStream(); // this the OutputStream you need to save your Document.
try
t.transform(new DomSource(dXml), new StreamResult(new OutputStreamWriter(osSave)));
finally
osSave.close();
And your Document was now saved. -
Steps in converting a xml file with an rtf template to a pdf
Hey all,
What are the steps in converting a xml file with an rtf template to a pdf using XML Publisher from command line.
Thanks
RaviI don't have any code to do exactly what you wish, but it shouldn't be too difficult and http://www.dadhi.com/2007/06/generate-and-store-pdf-file-in-same.html is a good starting point.
Paul -
Catch all error information while validating xml content with xsd schema
Hi experts,
I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below is a part of my java mapping.
XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
parser.setFeature( "http://xml.org/sax/features/validation" , true);
parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); // schema is my schema name
parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends DefaultHandler
parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
// In error handler, I comment all code so as not to throw any exception
public class ParseErrorHandler extends DefaultHandler
public void error(SAXParseException e) throws SAXException
// sSystem.out.println("Error" + e.getMessage());
// throw e;
public void fatalError(SAXParseException e)
// throw e;
// System.out.println("SAP Fatal Error" + e.getMessage());
Unfortunately the program always stopped while catching the first error. Check the below log.
com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
ERRORS :
cvc-simple-type : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
cvc-data : information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is is not valid with respoct to the corresponding simple type definition.
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' is associated with invalid data.
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]/:To[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]/:Header[1]' is not valid with respect to it's complex type definition..
cvc-element : element information item '/:ShipNotice[1]' is not valid with respect to it's complex type definition..
-> com.sap.engine.lib.xml.parser.ParserException:
I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error handler logic? Is there any body can make me get out of this?
Thanks.<h6>Hi experts,
<h6>
<h6>I created a java mapping to validating the input xml content with xsd schema (schema validation). What I want is to catch all <h6>error message to the xml not just the first error. I used SAXParser in sapxmltoolkit.jar to do the schema validation. The below <h6>is a part of my java mapping.
<h6>XMLReader parser = XMLReaderFactory.createXMLReader("com.sap.engine.lib.xml.parser.SAXParser");
<h6>parser.setFeature( "http://xml.org/sax/features/validation" , true);
<h6>parser.setFeature( "http://apache.org/xml/features/validation/schema" , true);
<h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); <h6>parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",this.getClass().getClassLoader().getResourceAsStream(schema)); <h6>// schema is my schema name
<h6>parser.setErrorHandler(new ParseErrorHandler()); // ParseErrorHandler is my own ErrorHandler which extends Default Handler
<h6>parser.parse(new InputSource(new ByteArrayInputStream(sinput.getBytes())));
<h6>
<h6>// In error handler, I comment all code so as not to throw any exception
<h6>public class ParseErrorHandler extends DefaultHandler
<h6>{
<h6> public void error(SAXParseException e) throws SAXException
<h6> {
<h6> // sSystem.out.println("Error" + e.getMessage());
<h6> // throw e;
<h6> }
<h6>
<h6> public void fatalError(SAXParseException e)
<h6> {
<h6> // throw e;
<h6> // System.out.println("SAP Fatal Error" + e.getMessage());
<h6>
<h6> }
<h6>
<h6>}
<h6>
<h6>Unfortunately the program always stopped while catching the first error. Check the below log.
<h6>
<h6>com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException:
<h6>ERRORS :
<h6>cvc-simple-type : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is not valid, because it's value does not satisfy the constraints of facet 'minLength' with value '1'.
<h6>cvc-data : information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is is not valid with respoct to the corresponding simple type definition.
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]/:CityName[1]' <h6>is associated with invalid data.
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]/:AddressInformation[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]/:PartnerInformation[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]/:To[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item <h6>'/:ShipNotice[1]/:Header[1]' <h6>is not valid with respect to it's complex type definition..
<h6>cvc-element : element information item '/:ShipNotice[1]' is not valid with <h6>respect to it's complex type definition..
<h6> -> com.sap.engine.lib.xml.parser.ParserException:
<h6>
<h6>
<h6>I tried using Xerces and JAXP to do validation, the same error happened. I have no idea on this. Does xi has its own error <h6>handler logic? Is there any body can make me get out of this?
<h6>Thanks. -
URGENT: XML Report with warning(java.lang.StackOverflowError)
Hello,
I have created a custom report using XML Publisher(with PDF output). The report runs fine for limited data. But when more than 3 Lakh records are retrieved, the report gets completed with Warning.
The log details show the following error message:
------------- 1) PUBLISH -------------
Beginning post-processing of request 18175653 on node PWXS3Q-E at 25-JUL-2008 06:56:22.
Post-processing of request 18175653 failed at 25-JUL-2008 06:58:01 with the error message:
One or more post-processing actions failed. Consult the OPP service log for details.
The OPP log shows the following message:
[7/24/08 10:37:04 PM] [main] Starting GSF service with concurrent process id = 297839.
[7/24/08 10:37:04 PM] [main] Initialization Parameters:
oracle.apps.fnd.cp.opp.OPPServiceThread:2:0:max_threads=5
[7/24/08 10:37:05 PM] [Thread-25] Service thread starting up.
[7/24/08 10:37:05 PM] [Thread-26] Service thread starting up.
[7/25/08 6:56:23 AM] [OPPServiceThread1] Post-processing request 18175653.
[7/25/08 6:56:23 AM] [297839:RT18175653] Executing post-processing actions for request 18175653.
[7/25/08 6:56:24 AM] [297839:RT18175653] Starting XML Publisher post-processing action.
[7/25/08 6:56:24 AM] [297839:RT18175653]
Template code: PFOA249P
Template app: XXPOP
Language: nl
Territory: NL
Output type: PDF
[7/25/08 6:58:00 AM] [UNEXPECTED] [297839:RT18175653] java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at oracle.apps.xdo.common.xml.XSLT10gR1.invokeProcessXSL(XSLT10gR1.java:580)
at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:378)
at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:197)
at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:156)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:916)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:869)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:204)
at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1497)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:913)
at
oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:1816)
at
oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:1278)
at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:247)
at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:153)
Caused by: java.lang.StackOverflowError
[7/25/08 6:58:01 AM] [297839:RT18175653] Completed post-processing actions for request 18175653.
Any help would be greatly appreciatedNote:315477.1 : XML Report Publisher Fails With java.lang.OutOfMemoryError.
Could any one point me to the right place where i can find this note. I searched in Oracle metalink and google but no success.Here you go ..
Note: 315477.1 - XML Report Publisher Fails With java.lang.OutOfMemoryError
https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=315477.1
Maybe you are looking for
-
Connect 24" Cinema Display with Mini DisplayPort to new 21.5' iMac
I'm having a bit of an issue attempting to connect my new 21.5' iMac to my Apple Cinema Display. The display has a mini DV port that used to connect into my MacBook Pro but now I see there is no such port on the iMac. They clearly state they offer s
-
Hi i have the G5 powermac oct 2004. The last G5 to carry the ADC and DVI ports i believe. hence my problem, as i don't want to pay for a very expensive apple display but i would like to dual monitor. i already have the DVI going to VGA going to phill
-
Display waveform or sound levels
I have audio that I am going to put into a movie. I need software that will make the sound levels into a quicktime movie so I display something visually as the audio is playing. Any ideas will be appreciated. Can Motion 2 do this?
-
Aurbuild says "not found in aur"!!!
I was trying to install some package from unsupported using aurbuild, but strangely it gives me the following error: [root@bluehead shantanu]# aurbuild -sae thinkingrock Editor environmental variable not set. Using nano... thinkingrock: not found in
-
What happens if you perform certain component update for iphoto '11 on mac twice?
Hi i know it sounds ridiculous and silly question to begin with, maybe i'm just being a little paranoid the thing is that i have update a certain component update for iphoto '11 twice which is "digital raw compatibility update 4.0.3" via automatic ap