Macro help: Nav Attribute Value
Dear Macro Gurus,
I need to realize this
IF the value of the Navigational Attribute "NavChar2" of a POS "Char1" is = a, b, and c
then
do something.
ENDIF
I could do the something
but couldn't get the macro function right for the IF.
Help appreciated
Thanks
BS
Is this any help? Function ACT_IOBJNM_VALUE with a double underscore to separate the characteristic from its nav attribute.
ACT_IOBJNM_VALUE( 'characteristic__navattr' ) = 'X'
which could be implemented in macro similar to attachment
Similar Messages
-
Tricky! Change of navi-attribute values in ABAP and use in selections
Hi gurus,
now I have a teaser that really keeps me busy, and which might be interesting for some of you:
we use several statuses in our <u>Demand Planning in SCM 5.0</u>, some of which can be switched by using a user-function macro which just basically is a ABAP function module that <u>changes navigation attribute values directly on the database</u>, meaning in the master data tables of the respective characteristic.
Now, the code works, the values are changed accordingly, leaving the data set in object status "active" - <b>BUT</b>:
<i>when we call a selection, it still shows the old values, even after activating master data or running the attribute change run!</i>
This is not what we expected. Our wish was, that once the table was updated with the correct field values, we would also see them in our selections.
<u>Details:</u>
we have two statuses as navi-attributes to an article:
<i>DP:</i> YES/NO, and
<i>oDP:</i> YES/NO
Combinations originally are: <i>DP</i> YES/<i>oDP</i> NO
After the status change macro, the table shows the following, as expected:
<i>DP</i> NO/<i>oDP</i> YES
As we have two selections, one on DP status "YES", the other one on oDP status "YES", we would like to see the article vanish in the first selection and show up in the other one...
Does anybody have an idea what is wrong and what we can do to have to proper navi-attribute values from the master data table in the selection? Does the selection not read from the database but from a buffer?
Looking forward to your answers,
KlausHi Fabrice,
yes indeed, I did check the object version, and it is A.
Problem is, the function module changes the data record which is "A" anyway. So the changed data record is active - however, I just had a look at the SID master data table, and it looks that direct changes to the P-table do not affect the X-table where the SIDs are stored. So I guess I will also have to update the X-table with the correct SID-values.
If this works, I let you know. We will be using this change by ABAP quite often, it is rather useful.
Regards and thanks for your prompt reply,
Klaus -
Need to show attributes value in the F4 help
Hello All
I am Having 0customer has a main characteristics and its attributes is 0city. In the selection screen of the report for 0customer i am able to view all the customer name. but as per the user requirement i need to display 0customer with city name so the user will select exact customer in the particular city.
Please tell me how to add 0city attributes value in the F4 help of 0customer.Hi Kamal,
Refer to Search help /BI0/OCUSTOMER , 0Customer uses it internally.
SE11 -> Select Search Help -> /BI0/OCUSTOMER -> Change .
Here you can delete / add more fields as per requirement .
Hope it helps.
Regards
Mr Kapadia -
Urgent help ----problem of component id and attribute value
I want to produce a dynamic menu that compoment id and attribute value will be dynamic assigned when logon to system. That means i have to use id="#{aid}" and value="#{avalue}" in following codes.
The problem are:
1. Component id looks only accepts constant (hard code data) insteads of varable. I changed id="ADMIN", and it works. It can be empty, and tag will give me one. Therefore, it is not too much affected me.
2. The f:attribute value, when value="Value" works. However, when value="#{avalue}", first time works, second time it throws Illegal State Exception. I really need this value be assigned by varable.
Can anyone help me out?
----------------------------------------------Code----------------------------------------------
<h:command_link id="#{aid}" action="#{Action.action}" >
<f:action_listener type="my.MenuListener"/>
<h:output_text value="Logon"/>
<f:attribute name="COMMAND" value="#{avalue}"/>
</h:command_link>-----------2 TreeMenu---------------
public class MenuTree implements Serializable{
private String treeId = null;
private String name = null;
private Map submenus = new TreeMap(); // name as key, submenu is value;
private String actionClass = null;
private boolean isLeaf = false;
private boolean isRoot = true;
private MenuTree parent = null;
public boolean isRoot() {
return isRoot;
public void setRoot(boolean root) {
isRoot = root;
public MenuTree(){
public MenuTree getParent(){
return parent;
public void setParent(MenuTree parent){
this.parent = parent;
if(parent != null) parent.putSubmenu(treeId, this);
isRoot = false;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public Map getSubmenus() {
return submenus;
public boolean getIsNode(){
return submenus.size() > 0;
public void putSubmenu(String name, MenuTree menu){
submenus.put(name, menu);
* @return Returns the isLeaf.
public boolean getIsLeaf() {
return isLeaf;
public boolean getIsRoot() {
return isRoot;
* @param isLeaf The isLeaf to set.
public void setLeaf(boolean isLeaf) {
this.isLeaf = isLeaf;
* @param submenus The submenus to set.
public void setSubmenus(Map submenus) {
this.submenus = submenus;
* @return Returns the actionClass.
public String getActionClass() {
return actionClass;
public void setActionClass(String actionClass) {
this.actionClass = actionClass;
public String getTreeId() {
return treeId;
* @param id The id to set.
public void setTreeId(String treeId) {
this.treeId = treeId;
------------3 JSP if want to test change subview to view. I am sure the treeId have value---------------------
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<% request.setAttribute("CONTEXT_PATH", request.getContextPath()); %>
<LINK rel="stylesheet" type="text/css" href='<c:out value="${requestScope.CONTEXT_PATH}"/>/style/menutree.css'/>
<SCRIPT type='text/javascript' src='<c:out value="${requestScope.CONTEXT_PATH}"/>/js/hideshow.js'></SCRIPT>
<!--f:loadBundle basename="bundle.common.Menu" var="bundle"/-->
<f:subview id="userMenuView">
<h:form id="userMenuForm">
<c:set var="root" value="${sessionScope.menuTree}"/>
<table class="" width="150px" bgcolor="blue">
<c:forEach var="menuBar" begin="0" items="${root.submenus}">
<c:set var="menu" value="${menuBar.value}"/>
<tr>
<td>
<c:choose>
<c:when test="${menu.isLeaf}">
<c:set var="menuJSF" value="${menu}" scope="request"/>
<h:command_link action="#{Action.action}">
<f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
<h:output_text value="#{menuJSF.name}"/>
<f:attribute value="#{menuItemJSF.treeId}">
</h:command_link>
</c:when>
<c:otherwise>
<span class="" onclick="javascript:hideshow('<c:out value="${menu.treeId}"/>')">
<c:out value="${menu.name}"/>
</span>
<div id='<c:out value="${menu.treeId}"/>' >
<table class="">
<c:forEach var="submenu" begin="0" items="${menu.submenus}">
<c:set var="menuItem" value="${submenu.value}"/>
<tr>
<td>
<c:choose>
<c:when test="${menuItem.isLeaf}">
<c:set var="menuItemJSF" value="${menuItem}" scope="request"/>
<h:command_link action="#{Action.action}">
<f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
<h:output_text value="#{menuItemJSF.name}"/>
<f:attribute value="#{menuItemJSF.treeId}">
</h:command_link>
</c:when>
<c:otherwise>
<span class="" onclick="javascript:hideshow('<c:out value="${menuItem.treeId}"/>')">
<c:out value="${menuItem.name}"/>
</span>
<div id='<c:out value="${menuItem.treeId}"/>' >
<table class="">
<c:forEach var="item" begin="0" items="${menuItem.submenus}">
<c:set var="itemObj" value="${item.value}"/>
<tr>
<td>
<c:choose>
<c:when test="${itemObj.isLeaf}">
<c:set var="itemObjJSF" value="${itemObj}" scope="request"/>
<h:command_link action="#{Action.action}">
<f:action_listener type="com.nusino.web.listener.menu.MenuListener"/>
<h:output_text value="#{itemObjJSF.name}"/>
<f:attribute value="#{itemObjJSF.treeId}">
</h:command_link>
</c:when>
<c:otherwise>
<span class="">
<c:out value="${itemObj.name}"/>
</span>
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</table>
</div>
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</table>
</div>
</c:otherwise>
</c:choose>
</td>
</tr>
</c:forEach>
</table>
<script language= "javascript" >
function prehide(){
<c:forEach var="menuBar" begin="0" items="${root.submenus}">
<c:set var="menu" value="${menuBar.value}"/>
<c:if test="${!menu.isLeaf}">
hide('<c:out value="${menu.treeId}"/>');
<c:forEach var="submenu" begin="0" items="${menu.submenus}">
<c:set var="menuItem" value="${submenu.value}"/>
<c:if test="${!menuItem.isLeaf}">
hide('<c:out value="${menuItem.treeId}"/>');
</c:if>
</c:forEach>
</c:if>
</c:forEach>
if(document.all){
prehide();
</script>
</h:form>
</f:subview> -
Need Help :: Current row attribute value returning null
Hi Frds,
I am facing the problem that
Current row attribute value returning null............ even though value is there..... plz.. he
This is the code in PFR
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
String pPersonId = pageContext.getParameter("ctrlPersonId");
String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
OptionsVORowImpl curRow = ( OptionsVORowImpl) am.findRowByRef(rowReference);
String dtlsItem = (String)curRow.getFlexValue(); /* this is returning null value */
/* here creating the hashmap and calling the page with the hashmap*/
Thanks & Regards,
jaya
Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810Hi Jaya,
You want to catch Flexfield values?
Try below code for catch value.
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("queryBtn")!= null)
OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
String dtlsItem = (String)Stylebean.getText(pageContext);
/* here creating the hashmap and calling the page with the hashmap*/
Thanks,
Dilip -
Hi All,
Here is my issue...
I've a sales report against Multi Provider to display a filed <b>'Province Ship To'</b>, it is a Nav attribute of <b>'Customer Ship To'</b>. I've verified in mastre data of <b>'Province Ship To'</b> that there are values for both text (Medium & Short) & Key and also verified values exits in MP through LISTCUBE. But when I run a query I'm getting 'Not Assigned" value for <b>'Province Ship To'</b> and I need to see full description it.
I'd appreciate if some one could help me on this as this is urgent...
Thanks
BI ConsultantThats what I did, display as both TEXT & KEY. For KEY it is showing up, for example OR in KEY but not showing up the description for TEXT/Name column, isntead it is showing as "Not Assigned" for all records.
I've verified Short & Med description extits for all records in Masterdata.
Example:
<b>Key Txt/Name Desc.</b>
OR Oregon
CA California
CT Connecticut
Thanks -
Populate key figure attributes values for material & location in inventory
Hi all,
We have a Inventory Infocube. the dimensions of the inventory infocube contains material, location and material-location and also the time dimension with calday, week and month. The different key figures in the infocube are Unrestricted Stock Balances, Unrestricted Stock Receipts, Unrestricted Stock Issues, QI Stock Balances, QI Stock Issues, QI Stock Reciepts, Blocked Stock Balances, Blocked Stock Receipts, Blocked Stock Issues. The following is the definition for master data objects
Material Master - ATTRIBUTES :- Business Unit, Manufacturing Plant, Base to Case Conversion Factor(key figure attribute)
Location Master - ATTRIBUTES:- City, State, Country, Location Type
Material Location master - ATTRIBUTES:- Material, Location, MRP Controller, Source Location, Standard Cost(key figure attribute)
We have a report with material, location, calender day and with all the stock balances keyfigures. also in the report we have the key figure attributes of material master and material location (like standard cost and base to case conversion). We have defined a formula variable on these attribute key figures with replacement path.
The problem is none of the records are getting populated with the standard cost and base to case conversion.
We are NOT doing any conversion at the report level.
Any help is greatly appreciated.
Regards
VijayThere could be few possibility:
1. The variable you are inputting for standard cost and base to case conversion may not have any values in the master data.
2. See the master data table for Material and location. Note down those materails and location for which there are values for standard cost and base to case conversion. Now, run the reports for these materials
and location.
Btw, have made standard cost and base to case conversion as nav attributes. Plz make them nav attributes and see.
Thanks...
Shambhu -
Hello Experts,
This is the situation.
Three Infobjects:
Sales Ord
System ID
Sales Ord Rpt
Compounded:
Sales Ord is compounded with system ID to make it unique
Sales Ord Rpt is a nav attribute of Sales Ord
Sales Ord Rpt = Sales Ord
Purpose of Sales Ord Rpt:
In the reporting to provide rollup on Sales Ord
Master data:
loaded for Sales Ord
Trx Data feed:
Transaction data is feed into Sales Ord Infobject & system ID.
Report:
rollup required on the Sales Ord Rpt
Will the report show the values of Sales Ord Rpt.
I know that I am missing something in here. Any suggestions appreciated.
Thanks,
Sweatha.Hi Sweatha,
I follow you up to Trx Data Feed. Does your Trx data load into a cube or ODS? If you are using a cube or ODS then the Trx data will roll up to the aggregated level of that object. For example: if Sales Ord is the key then all records will be at that level or if Sales Ord and Sales Item are the key then the records will be at the Sales Item level. If you are loading this data into a master data object then the key is the master data object, example: all data in Sales Ord master data roll up to the Sales Ord.
Hope this helps,
Aaron Blasi -
Authorization for multiple nav attributes
Hi Experts,
I have 2 doubts that I need to confirm with you:
Scenario :
an aggregation level has nav attributes A__C and B__C.
A__C is restricted by authorization variable in the filter section of the query.
A__C is shown in the rows as well.
B__C is not defined anywhere in the aggregation level and the query.
Authorization is created for the user on A__C and B__C and assigned to user via the BI7 auth admin tcode(s).
The requirement is to control such that user cannot access certain values of Both A__C values and B__C values found in records. In this case, user is set to access only :
A__C : 1111
B__C : 2222
A record exist like this :
A__C **** B__C **** KF
1111 **** 3333 **** $1000
Question:
1. when the query is executed, authorization check is ok for A__C and the query should execute.
But given that this user is not authorized to B__C = 3333, will the KF value of $1000 be displayed by the query at runtime assuming the query only is selecting A__C and the KF?
If it does not show results or shows 'not authorized' , can I say its due to B__C = 2222 is granted and not B__C = 3333 was granted?
Else if it does show the $1000, can I say that even if B__C is set = 2222 in the user profile / authorization object assigned, there is no effect of authorization in this case and the record having B__C = 3333 will be displayed with the KF value (B__C value still will not be shown as its not in the query definition).
2. Assuming char C is defined in the query and aggregation level, must this be individually restricted (i.e set auth of C = value1, value2 .....) in authorization object or roles in order that the effect of A__C is achieved where authorization values for A__C is defined by setting auth of A__C = value 1, value2 ...?
Scenario A: char C is in the aggregation level but not used in the query definition in the rows and filter.
Scenario B : char C is in the aggregation level and used in the query definition in the rows.
What would the result be in the above 2 scenarios ?
Hope to get enlightened about this aspects.
Thanks in advance.
Best regards
PRex
Edited by: pointes rexiproca on Apr 3, 2008 6:21 PM
Edited by: pointes rexiproca on Apr 3, 2008 6:22 PMDear Pointes,
For management authorization by navigational attribute, I suggest the following steps:
1. Should check the attribute setup of A and B InfoObject in Tcode RSD1, and be sure if they are relevant of authorization. Remember, in BI2004s the attribute navigational are different component authorization.
2. Then, you should check your analysis authorization in Tcode RSECADMIN Authorization and verify which these attributes navigational A__C and B__C are included in analysis authorization, and what value do they have? Be careful which logical sing <, >, = . Also, remember include colum : value in each attribute navigational for avoid problem.
3. Before that, you should check the queries structure and be sure if theses attribute is like a entry variable authorization.
I hope that can help you,
Luis -
Not getting attribute values in IPC routines Scenerio R/3 B2B using AP 7.0
Hi,
Our Scenerio is using ISA R/3 B2B using AP 7.0. I have developed IPC routines but when i debug my routines in SM53 I notice that I'm not getting any attribute value except for VKORG.
I'm pasting the code below. Please help me if I have to implement some BADI or do something more to get the attribute values.
I have defined the attributes properly in Routine assignment in tcode /n/sapcnd/ueass
userexitlogger.writeLogDebug("*requirment 901*" + "Plant = "plant"||ANZ_MONATE ="+ item.getAttributeValue(ANZ_MONATE_STR).toString()"||ANZ_JAHRE="item.getAttributeValue(ANZ_JAHRE_STR).toString()"||MATKL="item.getAttributeValue(MATKL_STR).toString()"||PSTYV="item.getAttributeValue(PSTYV_STR).toString()"||VKORG="item.getAttributeValue(VKORG_STR)"||PRSFD="item.getAttributeValue(PRSFD_STR)"||MVGR2="item.getAttributeValue(MVGR2_STR).toString()"||PRSDT="item.getAttributeValue(PRSDT_STR).toString()"||AUDAT="item.getAttributeValue(AUDAT_STR).toString());
I would reward points for help
Many Thanks n regards,
DipenderI would like to go through each Value of the xml file and give each Value a name
e.g. from the xml file <VentCount Value=1> Retreive the value above and giving it the name VentCount. Then I would beable to use the name vent count as follows:
setVentCount() //My own method can use as follows: setVentCount(VentCount); I would like to do his for ever value, each value with a specific name -
How to get attribute value from standard page ?
Hi,
How to get attribute value from standard page ?
String str = (String)vo.getCurrentRow().getAttrbute("RunId");
But this value is returning a null value ....
Can anyone help me to get this attribute value which is actually having a actual value .getCurrentRow() would always return null if no setCurrentRow() is used.
Please check the page design and understand how many rows of VO are there. You can also use the following to get the row:
vo.reset();
vo.next();
Regards
Sumit -
Attributes and attribute values for a Product
Hi all
Is there any table or FM from where I can get a list of all the attributes and the attribute values linked to a particular product?
I got tables which link product with Prod Category, Prod Category with Set types and so on.
Could anyoe please provide me an FM which will give the attribute and its values for a particular product?
Please help!!
Regards
DebolinaAttributes created under s settype will be under the table with the name of that particular settype itself i.e Table name and the settype name are the same.
The other part of your question of where to find the list of all settypes and their corresposing attributes, you can make use of COMM_PR_FRG_REL.
Regards,
Harshit -
How can I access the Attribute Values from the Search Region
Hi all,
I have a table which contains Company id, department id, and PositonId. For a particular Company and Department there may be multiple records.
I have to pupulate a table which contains the position and other details that comes under a particular Department and Position based on the selection in the Three comboBoxes.
Also I have to populate a select many Shuttle to add new postions and records under a particular Department.
I created a query panel *(Search Region)* for the serch and a table to display the data. That is working fine.
Now the issue is I am using a view criteria to populate the shuttle with two bind variables ie, DepartmentId and CompanyId.
If the serach will return a resuktant set in the table it will also pupulate the correct records, otherwise ie, if the if the serch result is empty the corresponding iterator and the attribute is setting as null.
SO I want to access the attribute values from the Search Region itsef to populate the shuttle.
I don't know how can I access the data from the Search Region.
Please Help.
Regards,
Ranjithyou could access the parameters entered in search region by the user as follows:
You can get handle to the value entered by the user using queryListener method in af:query.
You can intercept the values entered as described
public void onQueryList(QueryEvent queryEvent) {
// The generated QueryListener replaced by this method
//#{bindings.ImplicitViewCriteriaQuery.processQuery}
QueryDescriptor qdes = queryEvent.getDescriptor();
//get the name of the QueryCriteria
System.out.println("NAME "+qdes.getName());
List<Criterion> searchList = qdes.getConjunctionCriterion().getCriterionList();
for ( Criterion c : searchList) {
if (c instanceof AttributeCriterion ) {
AttributeCriterion a = (AttributeCriterion) c;
a.getValues();
for ( Object o : a.getValues()){
System.out.println(o.toString());
//call default Query Event
invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
public void onQueryTable(QueryEvent queryEvent) {
// The generated QueryListener replaced by this method
//#{bindings.ImplicitViewCriteriaQuery.processQuery}
QueryDescriptor qdes = queryEvent.getDescriptor();
//get the name of the QueryCriteria
System.out.println("NAME "+qdes.getName());
invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
private void invokeQueryEventMethodExpression(String expression, QueryEvent queryEvent){
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elctx = fctx.getELContext();
ExpressionFactory efactory = fctx.getApplication().getExpressionFactory();
MethodExpression me = efactory.createMethodExpression(elctx,expression, Object.class, new Class[]{QueryEvent.class});
me.invoke(elctx, new Object[]{queryEvent});
Thanks,
Navaneeth -
ImportNode() does not import attribute values
I want to import one part of xml document into another xml document. I use the Document.importNode() method to do this. Here's my code snippet:
Document newdoc = db.newDocument();
Node importedNode = newdoc.importNode(xmlnode,true);
But as the result the xml part is copied into importedNode, but attribute values are empty. What do I do wrong? I'm really lost, so thanks for ANY help.Well, the importNode() method should do this. But while using Xerces (I must use this one (currently in 1.4.4 version), not any other parser) you'll find out there is a bug in this method. It could work for you (maybe), but for me it just removes all the attribute values. So I'm still looking for an answer.
I wrote one very simple (not generic, which is enough for my case) method to just hack the behaviour, and I entered bug to Xerces bugzilla, but nobody cares ;O( for it. Sad, but true. -
Oracle XML DOM parser - attribute values are not printing on the screen ??
Hi Everyone,
I am just trying to use oracle DOM parser to paerse one of my xml file, java file can be compiled and run agianst a xml file, But I cannot see any attribute values printing on the screen..
Appreciate if anyone can help, where I have gone wrong please?
Below is the java file:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample { //public class eka ***
static public void main(String[] argv){ // main method eka ###
try {
if (argv.length != 1){
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
catch (Exception e){
System.out.println(e.toString());
} // main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i=0; i<nl.getLength(); i++){
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc){
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j=0; j < len; j++){
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null){
for (i=0; i<nnm.getLength(); i++){
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) { // podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) { /// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
} // BBBBBB
return url;
} // podi 3 End
} //public class eka ***
// End of program
output comes as below:
Isbn:
Title:
Price:
Author:
Message was edited by:
chandanalHi Chandanal,
I edited your code slightly and I was able to get the correct output.
I changed the following line:
for (int j=0; j >< len; j++)to:
for (int j=0; j < len; j++)I have included the complete source below:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample {
//public class eka ***
public static void main(String[] argv) {
// main method eka ###
try {
if (argv.length != 1) {
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
} catch (Exception e) {
System.out.println(e.toString());
// main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i = 0; i < nl.getLength(); i++) {
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j = 0; j < len; j++) {
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null) {
for (i = 0; i < nnm.getLength(); i++) {
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) {
// podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) {
/// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
// BBBBBB
return url;
// podi 3 End
} //public class eka ***-Blaise
Maybe you are looking for
-
my ipad is having trouble with my music... i had recently gotten a new one when i signed into my icloud the music that i had on the orignal one was not there.... some songs were in fact there but not clickable ( it was there only gray)... i was looki
-
Hi All, I apologize if this has already been discussed, but I probably cannot guess the right search string to find the relevant thread. I've recently upgraded from FM6 Mac to FM9 Win. My old FM6 documents have two kinds of problems in FM9: 1) replac
-
Deployment descriptor "weblogic.xml" is malformed. in managed server
Hi All, Appreciate if anyone can help. I have set up a cluster containing two nodes - one local and other remote machine on weblogic 8.1.4 then i install my application this cluster setup its working fine.
-
Accessing a form from an applett
Is something like that possible? And if, how does it work? a.html: <applet code=a.class /> <form name=afrom> <input name=inp1 type=text> </form> a.java: String s = magicCall().aform.inp1.value; // read out the formular magicCall().aform.inp1.value =
-
Sharepoint 2013 workflow does not start when item is created by another workflow
Hi I am having the next problem, I have a workflow on list B that starts when a new item is created. If I created the item manually the workflow works. Now I have a list A that has a workflow that creates a new item in List B. The problem is that whe